[Rt-commit] rt branch, 4.4/sla-content-cf, created. rt-4.2.12-353-ge52f2e1

? sunnavy sunnavy at bestpractical.com
Thu Oct 29 12:24:35 EDT 2015


The branch, 4.4/sla-content-cf has been created
        at  e52f2e1adfa45e514fd0bc5784dd181558ab52e3 (commit)

- Log -----------------------------------------------------------------
commit e52f2e1adfa45e514fd0bc5784dd181558ab52e3
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 30 00:12:12 2015 +0800

    pre-define "Content" cf for articles
    
    so people can more easily start using articles.
    Fixes: I#31323

diff --git a/etc/initialdata b/etc/initialdata
index ce913ec..078da41 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -947,3 +947,13 @@ Hour:         { $SubscriptionObj->SubValue('Hour') }
         HotList           => 1,
     },
 );
+
+ at CustomFields = (
+    {
+        Name              => 'Content',
+        Description       => 'Content',
+        LookupType        => 'RT::Class-RT::Article',
+        Type              => 'Text',
+        MaxValues         => 1,
+    },
+);
diff --git a/t/api/customfield.t b/t/api/customfield.t
index 83ea2da..dedeaa2 100644
--- a/t/api/customfield.t
+++ b/t/api/customfield.t
@@ -47,7 +47,7 @@ $cf = RT::CustomField->new(RT->SystemUser);
 ok( ! $ok, "Correctly could not create with bogus type: $msg");
 
 # Test adding and removing CFVs
-$cf->Load(1);
+$cf->Load(2);
 ($ok, $msg) = $cf->AddValue(Name => 'foo' , Description => 'TestCFValue', SortOrder => '6');
 ok($ok, "Added a new value to the select options");
 ($ok, $msg) = $cf->DeleteValue($ok);
@@ -131,7 +131,7 @@ warning_like {
 
 
 # Make it only apply to one queue
-$cf->Load(1);
+$cf->Load(2);
 my $ocf = RT::ObjectCustomField->new( RT->SystemUser );
 ( $ok, $msg ) = $ocf->LoadByCols( CustomField => $cf->id, ObjectId => 0 );
 ok( $ok, "Found global application of CF" );
@@ -273,7 +273,7 @@ ok( ! $cf->id, "Also doesn't find with Queue => 0 and IncludeGlobal" );
 
 
 # Change the lookup type to be a _user_ CF
-$cf->Load(1);
+$cf->Load(2);
 ($ok, $msg) = $cf->SetLookupType( RT::User->CustomFieldLookupType );
 ok($ok, "Changed CF type to be a CF on users" );
 $ocf = RT::ObjectCustomField->new( RT->SystemUser );
@@ -308,7 +308,7 @@ ok($cf->id, "Also with user CF and explicit global" );
 
 
 # Add a second, queue-specific CF to test load order
-$cf->Load(1);
+$cf->Load(2);
 ($ok, $msg) = $cf->SetLookupType( RT::Ticket->CustomFieldLookupType );
 ok($ok, "Changed CF type back to be a CF on tickets" );
 $ocf = RT::ObjectCustomField->new( RT->SystemUser );
diff --git a/t/articles/basic-api.t b/t/articles/basic-api.t
index 168b8cb..b232363 100644
--- a/t/articles/basic-api.t
+++ b/t/articles/basic-api.t
@@ -34,6 +34,13 @@ can_ok($class, 'CurrentUserHasRight');
 my $cf = RT::CustomField->new($RT::SystemUser);
 isa_ok($cf, 'RT::CustomField');
 
+# the following tests don't expect to see the new pre-defined "Content" cf.
+# disabling the pre-defined one so we can test if old behavior still works
+$cf->Load(1);
+$cf->SetDisabled(1);
+
+$cf = RT::CustomField->new($RT::SystemUser);
+
 ($id,$msg) = $cf->Create( Name => 'Articles::Sample-'.$$,
              Description => 'Test text cf',
              LookupType => RT::Article->CustomFieldLookupType,
diff --git a/t/web/cf_image.t b/t/web/cf_image.t
index 36eba51..3b72dad 100644
--- a/t/web/cf_image.t
+++ b/t/web/cf_image.t
@@ -20,8 +20,8 @@ my $cfid = $m->form_name('ModifyCustomField')->value('id');
 ok $cfid, "Created CF correctly";
 
 $m->follow_link_ok( {id => "page-applies-to"} );
-$m->form_with_fields( "AddCustomField-1" );
-$m->tick( "AddCustomField-1", 0 );
+$m->form_with_fields( "AddCustomField-2" );
+$m->tick( "AddCustomField-2", 0 );
 $m->click_ok( "UpdateObjs" );
 $m->content_contains("Globally added custom field Images");
 
@@ -46,7 +46,7 @@ $m->content_contains("Upload one image");
 $m->submit_form_ok({
     form_name => "TicketModify",
     fields    => {
-        "Object-RT::Ticket-1-CustomField-1-Upload" =>
+        "Object-RT::Ticket-1-CustomField-2-Upload" =>
             RT::Test::get_relocatable_file('bpslogo.png', '..', 'data'),
     },
 });
@@ -54,7 +54,7 @@ $m->content_contains("bpslogo.png added");
 $m->content_contains("/Download/CustomFieldValue/1/bpslogo.png");
 
 $m->form_name("TicketModify");
-$m->tick("Object-RT::Ticket-1-CustomField-1-DeleteValueIds", 1);
+$m->tick("Object-RT::Ticket-1-CustomField-2-DeleteValueIds", 1);
 $m->click_ok("SubmitTicket");
 $m->content_lacks("/Download/CustomFieldValue/1/bpslogo.png");
 
diff --git a/t/web/cf_onqueue.t b/t/web/cf_onqueue.t
index 2b1203b..7455933 100644
--- a/t/web/cf_onqueue.t
+++ b/t/web/cf_onqueue.t
@@ -32,7 +32,7 @@ diag "Apply the new CF globally";
     $m->content_contains('QueueCFTest', 'CF QueueCFTest displayed on page' );
 
     $m->form_name('EditCustomFields');
-    $m->tick( AddCustomField => 1 );
+    $m->tick( AddCustomField => 2 );
     $m->click('UpdateCFs');
 
     $m->content_contains("Globally added custom field QueueCFTest", 'CF QueueCFTest enabled globally' );
@@ -48,9 +48,9 @@ diag "Edit the CF value for default queue";
     $m->submit_form(
         form_number => 3,
         # The following doesn't want to works :(
-        #with_fields => { 'Object-RT::Queue-1-CustomField-1-Value' },
+        #with_fields => { 'Object-RT::Queue-1-CustomField-2-Value' },
         fields => {
-            'Object-RT::Queue-1-CustomField-1-Value' => 'QueueCFTest content',
+            'Object-RT::Queue-1-CustomField-2-Value' => 'QueueCFTest content',
         },
     );
     $m->content_contains('QueueCFTest QueueCFTest content added', 'Content filed in CF QueueCFTest for default queue' );

-----------------------------------------------------------------------


More information about the rt-commit mailing list