Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1167658
D529.id1402.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Sep 23, 9:39 PM
Size
41 KB
Mime Type
text/x-diff
Expires
Wed, Sep 24, 9:39 PM (12 h, 12 m)
Engine
blob
Format
Raw Data
Handle
756363
Attached To
D529: INP-1917 - Validate "kOptionsFormatter::Parse" method values
D529.id1402.diff
View Options
Index: core/install/english.lang
===================================================================
--- core/install/english.lang
+++ core/install/english.lang
@@ -309,6 +309,7 @@
<PHRASE Label="la_err_Primary_Lang_Required" Module="Core" Type="1">UHJpbWFyeSBMYW5nLiB2YWx1ZSBSZXF1aXJlZA==</PHRASE>
<PHRASE Label="la_err_required" Module="Core" Type="1">RmllbGQgaXMgcmVxdWlyZWQ=</PHRASE>
<PHRASE Label="la_err_unique" Module="Core" Type="1">RmllbGQgdmFsdWUgbXVzdCBiZSB1bmlxdWU=</PHRASE>
+ <PHRASE Label="la_err_unknown_option" Module="Core" Type="1">T3B0aW9uICJ7b3B0aW9ufSIgaXMgdW5rbm93bg==</PHRASE>
<PHRASE Label="la_err_value_out_of_range" Module="Core" Type="1">RmllbGQgdmFsdWUgaXMgb3V0IG9mIHJhbmdlLCBwb3NzaWJsZSB2YWx1ZXMgZnJvbSB7bWluX3ZhbHVlfSB0byB7bWF4X3ZhbHVlfQ==</PHRASE>
<PHRASE Label="la_exportfoldernotwritable" Module="Core" Type="1">RXhwb3J0IGZvbGRlciBpcyBub3Qgd3JpdGFibGU=</PHRASE>
<PHRASE Label="la_fck_ErrorCreatingFolder" Module="Core" Type="1">RXJyb3IgY3JlYXRpbmcgZm9sZGVyLiBFcnJvciBudW1iZXI6</PHRASE>
Index: core/kernel/application.php
===================================================================
--- core/kernel/application.php
+++ core/kernel/application.php
@@ -799,6 +799,10 @@
$this->registerClass('QAToolsUrlFactory', KERNEL_PATH . '/tests/Url/QAToolsUrlFactory.php');
$this->registerClass('AbstractTestCase', KERNEL_PATH . '/../tests/Unit/AbstractTestCase.php');
$this->registerClass(
+ 'AbstractUnknownOptionTestCase',
+ KERNEL_PATH . '/../tests/Functional/AbstractUnknownOptionTestCase.php'
+ );
+ $this->registerClass(
'AbstractBrowserTestCase',
KERNEL_PATH . '/../tests/Functional/AbstractBrowserTestCase.php'
);
Index: core/kernel/db/cat_event_handler.php
===================================================================
--- core/kernel/db/cat_event_handler.php
+++ core/kernel/db/cat_event_handler.php
@@ -2909,9 +2909,11 @@
/** @var CategoryHelper $category_helper */
$category_helper = $this->Application->recallObject('CategoryHelper');
+ /** @var array $virtual_fields */
$virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields');
- $virtual_fields['CategoryId']['default'] = (int)$this->Application->GetVar('m_cat_id');
+ $category_id = $this->Application->GetVar('m_cat_id');
+ $virtual_fields['CategoryId']['default'] = $category_id > 0 ? (int)$category_id : null;
$virtual_fields['CategoryId']['options'] = $category_helper->getStructureTreeAsOptions();
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields);
Index: core/kernel/utility/validator.php
===================================================================
--- core/kernel/utility/validator.php
+++ core/kernel/utility/validator.php
@@ -60,6 +60,7 @@
'invalid_format' => '!la_err_invalid_format!', // Incorrect data format, please use %s
'bad_date_format' => '!la_err_bad_date_format!', // Incorrect date format, please use (%s) ex. (%s)
'primary_lang_required' => '!la_err_primary_lang_required!', // Primary Lang. value Required
+ 'unknown_option' => '!la_err_unknown_option!', // Option "{option}" is unknown
);
/**
Index: core/tests/Unit/kernel/utility/formatters/options_formatterTest.php
===================================================================
--- /dev/null
+++ core/tests/Unit/kernel/utility/formatters/options_formatterTest.php
@@ -0,0 +1,139 @@
+<?php
+
+/**
+ * The class name must match the file name for Phabricator-invoked PHPUnit to run this test.
+ *
+ * TODO: Once "options_formatter.php" file is renamed we can rename this class/filename as well.
+ */
+class options_formatterTest extends AbstractTestCase // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
+{
+
+ /**
+ * Fixture of the kDBItem class.
+ *
+ * @var kDBItem
+ */
+ protected $dbItemFixture;
+
+ /**
+ * @before
+ */
+ protected function setUpTest()
+ {
+ $db_item = new kDBItem();
+ $db_item->Init('stop-word', ''); // Existing unit used for the "ValidatorClass" unit config option to work.
+ $db_item->SetFieldOptions(
+ 'SampleField',
+ array(
+ 'options' => array(1 => 'la_ADP', 2 => 'la_AED', 3 => 'la_AFA', 4 => 'la_ALL'),
+ )
+ );
+
+ $this->dbItemFixture = $db_item;
+ }
+
+ public function testParseEmptyValue()
+ {
+ $option_formatter = new kOptionsFormatter();
+ $actual = $option_formatter->Parse('', 'SampleField', $this->dbItemFixture);
+
+ $this->assertEmpty($this->dbItemFixture->GetErrorPseudo('SampleField'), 'No validation errors');
+ $this->assertNull($actual);
+ }
+
+ /**
+ * @dataProvider usePhrasesDataProvider
+ */
+ public function testParseKnownOptionByValue($use_phrases)
+ {
+ $option_formatter = new kOptionsFormatter();
+ $this->dbItemFixture->SetFieldOption('SampleField', 'use_phrases', $use_phrases);
+
+ $option_title = $use_phrases ? 'UAE Dirham' : 'la_AED';
+ $actual = $option_formatter->Parse($option_title, 'SampleField', $this->dbItemFixture);
+
+ $this->assertEmpty($this->dbItemFixture->GetErrorPseudo('SampleField'), 'No validation errors');
+ $this->assertSame(2, $actual);
+ }
+
+ public function testParseKnownOptionByKey()
+ {
+ $option_formatter = new kOptionsFormatter();
+ $actual = $option_formatter->Parse(2, 'SampleField', $this->dbItemFixture);
+
+ $this->assertEmpty($this->dbItemFixture->GetErrorPseudo('SampleField'), 'No validation errors');
+ $this->assertSame(2, $actual);
+ }
+
+ public function testParseUnknownOption()
+ {
+ $option_formatter = new kOptionsFormatter();
+ $option_title_in = 'option5';
+ $actual = $option_formatter->Parse($option_title_in, 'SampleField', $this->dbItemFixture);
+
+ $this->assertEquals('unknown_option', $this->dbItemFixture->GetErrorPseudo('SampleField'));
+ $this->assertEquals('Option "option5" is unknown', $this->dbItemFixture->GetErrorMsg('SampleField'));
+ $this->assertSame($option_title_in, $actual, 'Given value returned as-as');
+ }
+
+ /**
+ * @dataProvider usePhrasesDataProvider
+ */
+ public function testParseKnownOptionsByKey($use_phrases)
+ {
+ $option_formatter = new kOptionsFormatter();
+ $this->dbItemFixture->SetFieldOption('SampleField', 'use_phrases', $use_phrases);
+
+ $option_titles = $use_phrases ? '|Leck|UAE Dirham|' : '|la_ALL|la_AED|';
+ $actual = $option_formatter->Parse($option_titles, 'SampleField', $this->dbItemFixture);
+
+ $this->assertEmpty($this->dbItemFixture->GetErrorPseudo('SampleField'), 'No validation errors');
+ $this->assertSame('|4|2|', $actual);
+ }
+
+ public function testParseUnknownOptions()
+ {
+ $option_formatter = new kOptionsFormatter();
+ $option_titles_in = '|la_ALL|missing|la_AED|missing 2|';
+ $actual = $option_formatter->Parse($option_titles_in, 'SampleField', $this->dbItemFixture);
+
+ $this->assertSame('unknown_option', $this->dbItemFixture->GetErrorPseudo('SampleField'));
+ $this->assertSame('Option "missing" is unknown', $this->dbItemFixture->GetErrorMsg('SampleField'));
+ $this->assertSame($option_titles_in, $actual, 'Given value returned as-as');
+ }
+
+ /**
+ * @dataProvider usePhrasesDataProvider
+ */
+ public function testParseKnownOptionsByKeyWithCommaSeparator($use_phrases)
+ {
+ $option_formatter = new kOptionsFormatter();
+ $this->dbItemFixture->SetFieldOption('SampleField', 'use_phrases', $use_phrases);
+
+ $option_titles = $use_phrases ? 'Leck, UAE Dirham' : 'la_ALL, la_AED';
+ $actual = $option_formatter->Parse($option_titles, 'SampleField', $this->dbItemFixture);
+
+ $this->assertEmpty($this->dbItemFixture->GetErrorPseudo('SampleField'), 'No validation errors');
+ $this->assertSame('|4|2|', $actual);
+ }
+
+ public function testParseUnknownOptionsWithCommaSeparator()
+ {
+ $option_formatter = new kOptionsFormatter();
+ $option_titles_in = 'la_ALL, missing, la_AED, missing 2';
+ $actual = $option_formatter->Parse($option_titles_in, 'SampleField', $this->dbItemFixture);
+
+ $this->assertSame('unknown_option', $this->dbItemFixture->GetErrorPseudo('SampleField'));
+ $this->assertSame('Option "missing" is unknown', $this->dbItemFixture->GetErrorMsg('SampleField'));
+ $this->assertSame($option_titles_in, $actual, 'Given value returned as-as');
+ }
+
+ public static function usePhrasesDataProvider()
+ {
+ return array(
+ 'not using phrases' => array(false),
+ 'using phrases' => array(true),
+ );
+ }
+
+}
Index: core/units/users/users_config.php
===================================================================
--- core/units/users/users_config.php
+++ core/units/users/users_config.php
@@ -422,7 +422,7 @@
'default' => 0
),
'PrimaryGroupId' => Array (
- 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %1$s FROM ' . TABLE_PREFIX . 'UserGroups WHERE Enabled = 1 AND FrontRegistration = 1',
+ 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %1$s FROM ' . TABLE_PREFIX . 'UserGroups WHERE Enabled = 1',
'option_key_field' => 'GroupId', 'option_title_field' => 'Name', 'default' => NULL
),
'OldStyleLogin' => Array (
Index: core/units/users/users_event_handler.php
===================================================================
--- core/units/users/users_event_handler.php
+++ core/units/users/users_event_handler.php
@@ -1539,6 +1539,10 @@
// 2. set default user registration group
$form_fields['PrimaryGroupId']['default'] = $this->Application->ConfigValue('User_NewGroup');
+ if ( !$this->Application->isAdmin ) {
+ $form_fields['PrimaryGroupId']['options_sql'] .= 'AND FrontRegistration = 1'; // TODO: Write tests.
+ }
+
// 3. allow avatar upload on Front-End
/** @var FileHelper $file_helper */
$file_helper = $this->Application->recallObject('FileHelper');
Index: modules/custom/tests/Functional/CustomUnknownOptionTest.php
===================================================================
--- /dev/null
+++ modules/custom/tests/Functional/CustomUnknownOptionTest.php
@@ -0,0 +1,41 @@
+<?php
+
+
+class CustomUnknownOptionTest extends AbstractUnknownOptionTestCase
+{
+
+ /**
+ * Object changes to compensate test environment incompatibilities
+ *
+ * @param kDBItem $object Object.
+ *
+ * @return void
+ */
+ protected function prepareObjectForTest(kDBItem $object)
+ {
+ if ( $object->Prefix === 'widget' ) {
+ $object->setRequired('Image', false);
+ }
+ }
+
+ public function createAndUpdateItemDataProvider()
+ {
+ return array(
+ 'Widgets' => array(
+ 'prefix' => 'widget',
+ 'create_hash' => array(
+ 'Title' => 'UnknownOptionTest',
+ 'Type' => 2,
+ 'Status' => 1,
+ 'Good' => 1,
+ ),
+ 'update_hash' => array(
+ 'Type' => 1,
+ 'Status' => 2,
+ 'Good' => '0',
+ ),
+ ),
+ );
+ }
+
+}
Index: modules/in-bulletin/tests/Functional/InBulletinUnknownOptionTest.php
===================================================================
--- /dev/null
+++ modules/in-bulletin/tests/Functional/InBulletinUnknownOptionTest.php
@@ -0,0 +1,145 @@
+<?php
+
+
+class InBulletinUnknownOptionTest extends AbstractUnknownOptionTestCase
+{
+
+ /**
+ * @beforeClass
+ */
+ public static function setUpTestBeforeClass()
+ {
+ parent::setUpTestBeforeClass();
+
+ $application =& kApplication::Instance();
+
+ self::$baseItems['u.logged'] = $application->recallObject(
+ 'u.logged',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['u.logged']->Clear();
+ self::$baseItems['u.logged']->SetDBField('FirstName', 'Intechnic');
+ self::$baseItems['u.logged']->SetDBField('LastName', 'Tester');
+ self::$baseItems['u.logged']->SetDBField('Password', 'UnknownOptionTest');
+ self::$baseItems['u.logged']->SetDBField('VerifyPassword', 'UnknownOptionTest');
+ self::$baseItems['u.logged']->SetDBField('Password_plain', 'UnknownOptionTest');
+ self::$baseItems['u.logged']->SetDBField('VerifyPassword_plain', 'UnknownOptionTest');
+ self::$baseItems['u.logged']->SetDBField('Email', 'in-bulletin-test@in-portal.org');
+ self::createBaseItem('u.logged', 'base user');
+
+ $application->StoreVar('admin', 1);
+ $application->SetVar('m_cat_id', self::$categories[0]->GetID());
+ $application->StoreVar('user_id', self::$baseItems['u.logged']->GetID());
+ }
+
+ /**
+ * Object changes to compensate test environment incompatibilities
+ *
+ * @param kDBItem $object Object.
+ *
+ * @return void
+ */
+ protected function prepareObjectForTest(kDBItem $object)
+ {
+ if ( $object->Prefix === 'emoticon' ) {
+ $object->setRequired('EmotionImage', false);
+ }
+ }
+
+ public function createAndUpdateItemDataProvider()
+ {
+ return array(
+ 'Emoticons' => array(
+ 'prefix' => 'emoticon',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionTest',
+ 'KeyStroke' => 'AA',
+ 'Enabled' => '0',
+ ),
+ 'update_hash' => array(
+ 'IsPopular' => '0',
+ 'Enabled' => 1,
+ ),
+ ),
+ 'Poll answers' => array(
+ 'prefix' => 'poll-answer',
+ 'create_hash' => array(
+ 'l1_Answer' => 'UnknownOptionTest',
+ 'Status' => '0',
+ ),
+ 'update_hash' => array(
+ 'Status' => 1,
+ ),
+ ),
+ 'Poll comments' => array(
+ 'prefix' => 'poll-comment',
+ 'create_hash' => array(
+ 'CreatedById' => array('base_item' => array('prefix' => 'u.logged', 'field' => 'Email')),
+ 'CommentBody' => 'UnknownOptionTest',
+ 'Status' => 2,
+ ),
+ 'update_hash' => array(
+ 'Status' => 1,
+ ),
+ ),
+ 'Polls' => array(
+ 'prefix' => 'poll',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionTest',
+ 'l1_Question' => 'UnknownOptionTest',
+ 'RequireLogin' => 1,
+ 'AllowComments' => '0',
+ 'AllowMultipleVotings' => '0',
+ 'Status' => '0',
+ ),
+ 'update_hash' => array(
+ 'RequireLogin' => '0',
+ 'AllowComments' => 1,
+ 'AllowMultipleVotings' => 1,
+ 'Status' => 1,
+ ),
+ ),
+ 'Private messages' => array(
+ 'prefix' => 'private-message',
+ 'create_hash' => array(
+ 'FromId' => array('base_item' => array('prefix' => 'u.logged', 'field' => 'Email')),
+ 'ToId' => array('base_item' => array('prefix' => 'u.logged', 'field' => 'Email')),
+ 'Body' => 'UnknownOptionTest',
+ 'FolderId' => 1,
+ 'Status' => 1,
+ ),
+ 'update_hash' => array(
+ 'FolderId' => '0',
+ 'Status' => '0',
+ ),
+ ),
+ 'Topics' => array(
+ 'prefix' => 'bb',
+ 'create_hash' => array(
+ 'TopicText' => 'UnknownOptionTest',
+ 'PostingText' => 'UnknownOptionTest',
+ 'OwnerId' => 'root',
+ 'CategoryId' => array('cat_0' => 'CategoryId'),
+ 'NotifyOwnerOnChanges' => 1,
+ 'EditorsPick' => 1,
+ 'Status' => 1,
+ 'TopicType' => '0',
+ 'NewItem' => 1,
+ 'PopItem' => 1,
+ 'HotItem' => 1,
+ ),
+ 'update_hash' => array(
+ 'NotifyOwnerOnChanges' => '0',
+ 'EditorsPick' => '0',
+ 'Status' => 2,
+ 'TopicType' => 1,
+ 'NewItem' => 2,
+ 'PopItem' => 2,
+ 'HotItem' => 2,
+ ),
+ ),
+ );
+ }
+
+}
Index: modules/in-commerce/tests/Functional/InCommerceUnknownOptionTest.php
===================================================================
--- /dev/null
+++ modules/in-commerce/tests/Functional/InCommerceUnknownOptionTest.php
@@ -0,0 +1,692 @@
+<?php
+
+
+class InCommerceUnknownOptionTest extends AbstractUnknownOptionTestCase
+{
+
+ /**
+ * @beforeClass
+ */
+ public static function setUpTestBeforeClass()
+ {
+ parent::setUpTestBeforeClass();
+
+ $application =& kApplication::Instance();
+
+ self::$baseItems['u.logged'] = $application->recallObject(
+ 'u.logged',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['u.logged']->Clear();
+ self::$baseItems['u.logged']->SetDBField('FirstName', 'Intechnic');
+ self::$baseItems['u.logged']->SetDBField('LastName', 'Tester');
+ self::$baseItems['u.logged']->SetDBField('Password', 'UnknownOptionTest');
+ self::$baseItems['u.logged']->SetDBField('VerifyPassword', 'UnknownOptionTest');
+ self::$baseItems['u.logged']->SetDBField('Password_plain', 'UnknownOptionTest');
+ self::$baseItems['u.logged']->SetDBField('VerifyPassword_plain', 'UnknownOptionTest');
+ self::$baseItems['u.logged']->SetDBField('Email', 'in-commerce-test@in-portal.org');
+ self::createBaseItem('u.logged', 'first base user');
+
+ $application->StoreVar('admin', 1);
+ $application->StoreVar('user_id', self::$baseItems['u.logged']->GetID());
+
+ self::$baseItems['u.second'] = $application->recallObject(
+ 'u.second',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['u.second']->Clear();
+ self::$baseItems['u.second']->SetDBField('FirstName', 'Intechnic');
+ self::$baseItems['u.second']->SetDBField('LastName', 'Developer');
+ self::$baseItems['u.second']->SetDBField('Password', 'UnknownOptionTest2');
+ self::$baseItems['u.second']->SetDBField('VerifyPassword', 'UnknownOptionTest2');
+ self::$baseItems['u.second']->SetDBField('Password_plain', 'UnknownOptionTest2');
+ self::$baseItems['u.second']->SetDBField('VerifyPassword_plain', 'UnknownOptionTest2');
+ self::$baseItems['u.second']->SetDBField('Email', 'dev@in-portal.org');
+ self::createBaseItem('u.second', 'second base user');
+
+ self::$baseItems['u.third'] = $application->recallObject(
+ 'u.third',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['u.third']->Clear();
+ self::$baseItems['u.third']->SetDBField('FirstName', 'Intechnic');
+ self::$baseItems['u.third']->SetDBField('LastName', 'Affiliate');
+ self::$baseItems['u.third']->SetDBField('Password', 'UnknownOptionTest3');
+ self::$baseItems['u.third']->SetDBField('VerifyPassword', 'UnknownOptionTest3');
+ self::$baseItems['u.third']->SetDBField('Password_plain', 'UnknownOptionTest3');
+ self::$baseItems['u.third']->SetDBField('VerifyPassword_plain', 'UnknownOptionTest3');
+ self::$baseItems['u.third']->SetDBField('Email', 'affiliate@in-portal.org');
+ self::createBaseItem('u.third', 'third base user');
+
+ self::$baseItems['apt.first'] = $application->recallObject(
+ 'apt.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['apt.first']->Clear();
+ self::$baseItems['apt.first']->SetDBField('Status', 1);
+ self::$baseItems['apt.first']->SetDBField('Name', 'UnknownOptionsTestBase');
+ self::createBaseItem('apt.first', 'first base affiliate payment type');
+
+ self::$baseItems['apt.second'] = $application->recallObject(
+ 'apt.second',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['apt.second']->Clear();
+ self::$baseItems['apt.second']->SetDBField('Status', 1);
+ self::$baseItems['apt.second']->SetDBField('Name', 'UnknownOptionsTestBase2');
+ self::createBaseItem('apt.second', 'second base affiliate payment type');
+
+ self::$baseItems['ap.first'] = $application->recallObject(
+ 'ap.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['ap.first']->Clear();
+ self::$baseItems['ap.first']->SetDBField('Name', 'UnknownOptionsTestBase');
+ self::$baseItems['ap.first']->SetDBField('Enabled', 1);
+ self::createBaseItem('ap.first', 'first base affiliate plan');
+
+ self::$baseItems['ap.second'] = $application->recallObject(
+ 'ap.second',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['ap.second']->Clear();
+ self::$baseItems['ap.second']->SetDBField('Name', 'UnknownOptionsTestBase2');
+ self::$baseItems['ap.second']->SetDBField('Enabled', 1);
+ self::createBaseItem('ap.second', 'second base affiliate plan');
+
+ self::$baseItems['affil.first'] = $application->recallObject(
+ 'affil',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['affil.first']->Clear();
+ self::$baseItems['affil.first']->SetDBField('PortalUserId', self::$baseItems['u.logged']->GetID());
+ self::$baseItems['affil.first']->SetDBField('Status', 1);
+ self::$baseItems['affil.first']->SetDBField('SSN', 'UnknownOptionsTestBase');
+ self::$baseItems['affil.first']->SetDBField('PaymentTypeId', self::$baseItems['apt.first']->GetID());
+ self::$baseItems['affil.first']->SetDBField('AffiliatePlanId', self::$baseItems['ap.first']->GetID());
+ self::createBaseItem('affil.first', 'first base affiliate');
+
+ self::$baseItems['affil.second'] = $application->recallObject(
+ 'affil.second',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['affil.second']->Clear();
+ self::$baseItems['affil.second']->SetDBField('PortalUserId', self::$baseItems['u.second']->GetID());
+ self::$baseItems['affil.second']->SetDBField('Status', 1);
+ self::$baseItems['affil.second']->SetDBField('SSN', 'UnknownOptionsTestBase');
+ self::$baseItems['affil.second']->SetDBField('PaymentTypeId', self::$baseItems['apt.first']->GetID());
+ self::$baseItems['affil.second']->SetDBField('AffiliatePlanId', self::$baseItems['ap.first']->GetID());
+ self::createBaseItem('affil.second', 'second base affiliate');
+
+ self::$baseItems['coup'] = $application->recallObject(
+ 'coup',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['coup']->Clear();
+ self::$baseItems['coup']->SetDBField('Name', 'UnknownOptionsTestBase');
+ self::$baseItems['coup']->SetDBField('Code', 'UnknownOptionsTestBase');
+ self::createBaseItem('coup', 'base coupon');
+
+ self::$baseItems['g.first'] = $application->recallObject(
+ 'g.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['g.first']->Clear();
+ self::$baseItems['g.first']->SetDBField('Name', 'UnknownOptionsTestFirst');
+ self::createBaseItem('g.first', 'first base group');
+
+ self::$baseItems['g.second'] = $application->recallObject(
+ 'g.second',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['g.second']->Clear();
+ self::$baseItems['g.second']->SetDBField('Name', 'UnknownOptionsTestSecond');
+ self::createBaseItem('g.second', 'second base group');
+
+ self::$baseItems['d'] = $application->recallObject(
+ 'd',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['d']->Clear();
+ self::$baseItems['d']->SetDBField('Name', 'UnknownOptionsTestBase');
+ self::$baseItems['d']->SetDBField('GroupId', self::$baseItems['g.first']->GetID());
+ self::createBaseItem('d', 'base discount');
+
+ self::$baseItems['manuf.base'] = $application->recallObject(
+ 'manuf.base',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['manuf.base']->Clear();
+ self::$baseItems['manuf.base']->SetDBField('Name', 'UnknownOptionsTestBase');
+ self::createBaseItem('manuf.base', 'base manufacturer');
+
+ self::$baseItems['p'] = $application->recallObject(
+ 'p',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['p']->Clear();
+ self::$baseItems['p']->SetDBField('l1_Name', 'UnknownOptionsTestBase');
+ self::$baseItems['p']->SetDBField('SKU', 'UnknownOptionsTestBase');
+ self::createBaseItem('p', 'base product');
+
+ self::$baseItems['p-rev'] = $application->recallObject(
+ 'p-rev',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['p-rev']->Clear();
+ self::$baseItems['p-rev']->SetDBField('CreatedById', self::$baseItems['u.logged']->GetID());
+ self::$baseItems['p-rev']->SetDBField('ReviewText', 'UnknownOptionsTestBase');
+ self::$baseItems['p-rev']->SetDBField('ItemId', self::$baseItems['p']->GetDBField('ResourceId'));
+ self::$baseItems['p-rev']->SetDBField('Rating', 3);
+ self::$baseItems['p-rev']->SetDBField('Status', 2);
+ self::createBaseItem('p-rev', 'base product review');
+
+ self::$baseItems['s'] = $application->recallObject(
+ 's',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['s']->Clear();
+ self::$baseItems['s']->SetDBField('Code', 'UnknownOptionsTestBase');
+ self::$baseItems['s']->SetDBField('Name', 'UnknownOptionsTestBase');
+ self::$baseItems['s']->SetDBField('SpeedCode', 'UnknownOptionsTestBase');
+ self::createBaseItem('s', 'base shipping type');
+
+ self::$baseItems['ord.base'] = $application->recallObject(
+ 'ord.base',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['ord.base']->Clear();
+ self::$baseItems['ord.base']->SetDBField('Number', '234567');
+ self::$baseItems['ord.base']->SetDBField('SubNumber', '00');
+ self::$baseItems['ord.base']->SetDBField('PortalUserId', self::$baseItems['u.logged']->GetID());
+ self::createBaseItem('ord.base', 'base order');
+ }
+
+ /**
+ * Object changes to compensate test environment incompatibilities
+ *
+ * @param kDBItem $object Object.
+ *
+ * @return void
+ */
+ protected function prepareObjectForTest(kDBItem $object)
+ {
+ if ( $object->Prefix == 'file' ) {
+ $object->setRequired('RealPath', false);
+ }
+ }
+
+ public function createAndUpdateItemDataProvider()
+ {
+ return array(
+ 'Manufacturers' => array(
+ 'prefix' => 'manuf',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionTest',
+ 'IsPopular' => 1,
+ 'State' => 'Illinois',
+ 'Country' => 'USA',
+ ),
+ 'update_hash' => array(
+ 'IsPopular' => '0',
+ 'State' => '',
+ 'Country' => '',
+ ),
+ ),
+ 'User Addresses' => array(
+ 'prefix' => 'addr',
+ 'create_hash' => array(
+ 'To' => 'Intechnic Tester',
+ 'Phone' => '0123456789',
+ 'Address1' => 'UnknownOptionsTest',
+ 'City' => 'UnknownOptionsTest',
+ 'Zip' => '60061',
+ 'State' => 'IL',
+ 'Country' => 'USA',
+ 'LastUsedAsBilling' => 1,
+ 'LastUsedAsShipping' => 1,
+ 'IsProfileAddress' => 1,
+ ),
+ 'update_hash' => array(
+ 'State' => '',
+ 'Country' => 'ITA',
+ 'LastUsedAsBilling' => '0',
+ 'LastUsedAsShipping' => '0',
+ 'IsProfileAddress' => '0',
+ ),
+ ),
+ 'Affiliate payment types' => array(
+ 'prefix' => 'apt',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionsTest',
+ 'Status' => 1,
+ 'IsPrimary' => 1,
+ ),
+ 'update_hash' => array(
+ 'Status' => '0',
+ 'IsPrimary' => '0',
+ ),
+ ),
+ 'Affiliate payments' => array(
+ 'prefix' => 'apayments.first',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionsTest',
+ 'AffiliateId' => array('base_item' => array('prefix' => 'u.logged', 'field' => 'Email')),
+ 'PaymentTypeId' => array(
+ 'base_item' => array('prefix' => 'apt.first', 'field' => 'PaymentTypeId'),
+ ),
+ ),
+ 'update_hash' => array(
+ 'AffiliateId' => array('base_item' => array('prefix' => 'u.second', 'field' => 'Email')),
+ 'PaymentTypeId' => array(
+ 'base_item' => array('prefix' => 'apt.second', 'field' => 'PaymentTypeId'),
+ ),
+ ),
+ ),
+ 'Affiliate plans' => array(
+ 'prefix' => 'ap',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionsTest',
+ 'PlanType' => 2,
+ 'ResetInterval' => 2628000,
+ 'PaymentType' => 1,
+ 'Enabled' => 1,
+ 'IsPrimary' => 1,
+ ),
+ 'update_hash' => array(
+ 'PlanType' => 1,
+ 'ResetInterval' => 7884000,
+ 'PaymentType' => '0',
+ 'Enabled' => '0',
+ 'IsPrimary' => '0',
+ ),
+ ),
+ 'Affiliates' => array(
+ 'prefix' => 'affil.test',
+ 'create_hash' => array(
+ 'PortalUserId' => array('base_item' => array('prefix' => 'u.third', 'field' => 'Email')),
+ 'SSN' => 'UnknownOptionsTest',
+ 'AffiliatePlanId' => array(
+ 'base_item' => array('prefix' => 'ap.first', 'field' => 'AffiliatePlanId'),
+ ),
+ 'Status' => 1,
+ 'PaymentTypeId' => array(
+ 'base_item' => array('prefix' => 'apt.first', 'field' => 'PaymentTypeId'),
+ ),
+ ),
+ 'update_hash' => array(
+ 'AffiliatePlanId' => array(
+ 'base_item' => array('prefix' => 'ap.second', 'field' => 'AffiliatePlanId'),
+ ),
+ 'Status' => 2,
+ 'PaymentTypeId' => array(
+ 'base_item' => array('prefix' => 'apt.second', 'field' => 'PaymentTypeId'),
+ ),
+ ),
+ ),
+ 'Coupons' => array(
+ 'prefix' => 'coup.test',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionsTest',
+ 'Code' => 'UnknownOptionsTest',
+ 'Status' => 2,
+ 'Type' => 2,
+ ),
+ 'update_hash' => array(
+ 'Status' => 1,
+ 'Type' => 1,
+ ),
+ ),
+ 'Coupon items' => array(
+ 'prefix' => 'coupi',
+ 'create_hash' => array(
+ 'CouponId' => array('base_item' => array('prefix' => 'coup', 'field' => 'CouponId')),
+ 'ItemResourceId' => array('cat_0' => 'ResourceId'),
+ 'ItemType' => 2,
+ ),
+ 'update_hash' => array(
+ 'ItemResourceId' => null,
+ 'ItemType' => '0',
+ ),
+ ),
+ 'Currencies' => array(
+ 'prefix' => 'curr',
+ 'create_hash' => array(
+ 'ISO' => 'BTC',
+ 'Name' => 'Bitcoin',
+ 'Symbol' => 'B',
+ 'SymbolPosition' => '0',
+ 'Status' => 0,
+ 'IsPrimary' => 1,
+ ),
+ 'update_hash' => array(
+ 'SymbolPosition' => 1,
+ 'Status' => 1,
+ 'IsPrimary' => '0',
+ ),
+ ),
+ 'Discounts' => array(
+ 'prefix' => 'd',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionsTest',
+ 'Status' => 1,
+ 'GroupId' => array('base_item' => array('prefix' => 'g.first', 'field' => 'Name')),
+ 'Type' => 2,
+ ),
+ 'update_hash' => array(
+ 'Status' => 2,
+ 'GroupId' => array('base_item' => array('prefix' => 'g.second', 'field' => 'Name')),
+ 'Type' => 1,
+ ),
+ ),
+ 'Discount items' => array(
+ 'prefix' => 'di',
+ 'create_hash' => array(
+ 'DiscountId' => array('base_item' => array('prefix' => 'd', 'field' => 'DiscountId')),
+ 'ItemResourceId' => array('cat_0' => 'ResourceId'),
+ 'ItemType' => 2,
+ ),
+ 'update_hash' => array(
+ 'ItemResourceId' => null,
+ 'ItemType' => '0',
+ ),
+ ),
+ 'Products' => array(
+ 'prefix' => 'p.test',
+ 'create_hash' => array(
+ 'l1_Name' => 'UnknownOptionsTest',
+ 'SKU' => 'UnknownOptionsTest',
+ 'AutomaticFilename' => '0',
+ 'ManufacturerId' => array(
+ 'base_item' => array('prefix' => 'manuf.base', 'field' => 'ManufacturerId'),
+ ),
+ 'Status' => 2,
+ 'BackOrder' => 1,
+ 'NewItem' => 1,
+ 'HotItem' => 1,
+ 'PopItem' => 1,
+ 'EditorsPick' => '0',
+ 'Featured' => 1,
+ 'OnSale' => 1,
+ 'Type' => PRODUCT_TYPE_DOWNLOADABLE,
+ 'InventoryStatus' => 1,
+ 'AccessGroupId' => array('base_item' => array('prefix' => 'g.first', 'field' => 'GroupId')),
+ 'AccessDurationType' => 7,
+ 'OptionsSelectionMode' => 1,
+ 'IsRecurringBilling' => 1,
+ 'ShippingMode' => 1,
+ ),
+ 'update_hash' => array(
+ 'AutomaticFilename' => 1,
+ 'ManufacturerId' => '',
+ 'Status' => 1,
+ 'BackOrder' => 2,
+ 'NewItem' => 2,
+ 'HotItem' => 2,
+ 'PopItem' => 2,
+ 'EditorsPick' => 1,
+ 'Featured' => '0',
+ 'OnSale' => '0',
+ 'Type' => PRODUCT_TYPE_TANGIBLE,
+ 'InventoryStatus' => 2,
+ 'AccessGroupId' => '',
+ 'AccessDurationType' => '',
+ 'OptionsSelectionMode' => '0',
+ 'IsRecurringBilling' => '0',
+ 'ShippingMode' => '0',
+ ),
+ ),
+ 'Files' => array(
+ 'prefix' => 'file',
+ 'create_hash' => array(
+ 'FileName' => 'UnknownOptionsTest',
+ 'FilePath' => 'UnknownOptionsTest.txt',
+ 'Status' => 0,
+ ),
+ 'update_hash' => array(
+ 'Status' => 1,
+ ),
+ ),
+ 'Reviews' => array(
+ 'prefix' => 'rev',
+ 'create_hash' => array(
+ 'CreatedById' => array('base_item' => array('prefix' => 'u.logged', 'field' => 'Email')),
+ 'ReviewText' => 'UnknownOptionTest',
+ 'ItemId' => array('base_item' => array('prefix' => 'p', 'field' => 'ResourceId')),
+ 'Rating' => 3,
+ 'Status' => 2,
+ ),
+ 'update_hash' => array(
+ 'Rating' => 5,
+ ),
+ ),
+ 'Spam reports' => array(
+ 'prefix' => 'spam-report',
+ 'create_hash' => array(
+ 'MessageText' => 'UnknownOptionTest',
+ 'ItemPrefix' => 'p-rev',
+ 'ItemId' => array('base_item' => array('prefix' => 'p-rev', 'field' => 'ReviewId')),
+ ),
+ 'update_hash' => array(
+ 'ItemPrefix' => '',
+ ),
+ ),
+ 'Gift certificates' => array(
+ 'prefix' => 'gc',
+ 'create_hash' => array(
+ 'Purchaser' => 'UnknownOptionTest',
+ 'Recipient' => 'UnknownOptionTest',
+ 'RecipientEmail' => 'recipient@in-portal.org',
+ 'RecipientFirstname' => 'Recipient',
+ 'RecipientLastname' => 'Recipient',
+ 'RecipientAddress1' => 'Address',
+ 'RecipientCity' => 'City',
+ 'RecipientState' => 'Illinois',
+ 'RecipientZipcode' => '60061',
+ 'RecipientCountry' => 'USA',
+ 'Code' => 'CODE',
+ 'Amount' => '12',
+ 'Status' => 1,
+ 'SendVia' => 1,
+ ),
+ 'update_hash' => array(
+ 'Status' => 2,
+ 'SendVia' => '0',
+ 'RecipientCountry' => 'AFG',
+ 'RecipientState' => '',
+ ),
+ ),
+ 'Orders' => array(
+ 'prefix' => 'ord.test',
+ 'create_hash' => array(
+ 'Number' => '123456',
+ 'SubNumber' => '00',
+ 'Status' => 1,
+ 'OnHold' => 1,
+ 'PortalUserId' => array('base_item' => array('prefix' => 'u.logged', 'field' => 'Email')),
+ 'BillingState' => 'Illinois',
+ 'BillingCountry' => 'USA',
+ 'PaymentType' => 'Credit Card',
+ 'PaymentCardType' => '2',
+ 'ShippingState' => 'Illinois',
+ 'ShippingCountry' => 'USA',
+ 'ShippingType' => array('base_item' => array('prefix' => 's', 'field' => 'ShippingID')),
+ 'ShippingOption' => 1,
+ 'ShippingGroupOption' => 1,
+ 'TransactionStatus' => 1,
+ 'IsRecurringBilling' => 1,
+ 'ChargeOnNextApprove' => 1,
+ ),
+ 'update_hash' => array(
+ 'Status' => 3,
+ 'OnHold' => '0',
+ 'BillingState' => '',
+ 'BillingCountry' => 'AFG',
+ 'PaymentType' => '',
+ 'PaymentCardType' => '',
+ 'ShippingState' => '',
+ 'ShippingCountry' => '',
+ 'ShippingType' => '',
+ 'ShippingOption' => '0',
+ 'ShippingGroupOption' => '0',
+ 'TransactionStatus' => 2,
+ 'IsRecurringBilling' => '0',
+ 'ChargeOnNextApprove' => '0',
+ ),
+ ),
+ 'Order items' => array(
+ 'prefix' => 'orditems.base',
+ 'create_hash' => array(
+ 'OrderId' => array('base_item' => array('prefix' => 'ord.base', 'field' => 'OrderId')),
+ 'ProductId' => array('base_item' => array('prefix' => 'p', 'field' => 'ProductId')),
+ 'ReturnType' => 2,
+ ),
+ 'update_hash' => array(
+ 'ReturnType' => '',
+ ),
+ ),
+ 'Payment types' => array(
+ 'prefix' => 'ord',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionTest',
+ 'Status' => 1,
+ 'IsPrimary' => 1,
+ 'BuiltIn' => 1,
+ 'GatewayId' => 1,
+ 'PlacedOrdersEdit' => 1,
+ ),
+ 'update_hash' => array(
+ 'Status' => '0',
+ 'IsPrimary' => '0',
+ 'BuiltIn' => '0',
+ 'GatewayId' => '0',
+ 'PlacedOrdersEdit' => '0',
+ ),
+ ),
+ 'Product prices' => array(
+ 'prefix' => 'pr',
+ 'create_hash' => array(
+ 'ProductId' => array('base_item' => array('prefix' => 'p', 'field' => 'ProductId')),
+ 'Negotiated' => 1,
+ 'AccessUnit' => 2,
+ 'IsPrimary' => 1,
+ ),
+ 'update_hash' => array(
+ 'Negotiated' => '0',
+ 'AccessUnit' => '',
+ 'IsPrimary' => '0',
+ ),
+ ),
+ 'Product option combinations' => array(
+ 'prefix' => 'poc',
+ 'create_hash' => array(
+ 'ProductId' => array('base_item' => array('prefix' => 'p', 'field' => 'ProductId')),
+ 'Combination' => unserialize('a:2:{i:2;s:3:"Red";i:1;s:2:"36";}'),
+ 'Price' => '0',
+ 'PriceType' => 2,
+ 'WeightType' => 2,
+ 'Availability' => '0',
+ ),
+ 'update_hash' => array(
+ 'PriceType' => 3,
+ 'WeightType' => 3,
+ 'Availability' => 1,
+ ),
+ ),
+ 'Product options' => array(
+ 'prefix' => 'po',
+ 'create_hash' => array(
+ 'ProductId' => array('base_item' => array('prefix' => 'p', 'field' => 'ProductId')),
+ 'Name' => 'UnknownOptionTest',
+ 'OptionType' => 1,
+ 'Required' => '0',
+ 'Listable' => 1,
+ ),
+ 'update_hash' => array(
+ 'OptionType' => 3,
+ 'Required' => 1,
+ 'Listable' => '0',
+ ),
+ ),
+ 'Shipping types' => array(
+ 'prefix' => 's.test',
+ 'create_hash' => array(
+ 'Code' => 'UnknownOptionsTest',
+ 'Name' => 'UnknownOptionTest',
+ 'SpeedCode' => 'UnknownOptionTest',
+ 'LocationFrom' => 3,
+ 'Type' => 2,
+ 'Status' => '0',
+ 'IsFreePromoShipping' => 1,
+ 'InsuranceType' => 1,
+
+ ),
+ 'update_hash' => array(
+ 'LocationFrom' => 4,
+ 'Type' => 1,
+ 'Status' => 1,
+ 'IsFreePromoShipping' => '0',
+ 'InsuranceType' => 2,
+ ),
+ ),
+ 'Shipping quote engines' => array(
+ 'prefix' => 'sqe',
+ 'create_hash' => array(
+ 'ClassName' => 'USPS',
+ 'Status' => 1,
+
+ ),
+ 'update_hash' => array(
+ 'Status' => '0',
+ ),
+ ),
+ 'Taxes' => array(
+ 'prefix' => 'tax',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionsTest',
+ 'Type' => 2,
+ 'ApplyToShipping' => 1,
+ 'ApplyToProcessing' => 1,
+
+ ),
+ 'update_hash' => array(
+ 'Type' => 1,
+ 'ApplyToShipping' => '0',
+ 'ApplyToProcessing' => '0',
+ ),
+ ),
+ 'Shipping Zones' => array(
+ 'prefix' => 'z',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionsTest',
+ 'Type' => 2,
+ 'CODallowed' => '0',
+
+ ),
+ 'update_hash' => array(
+ 'Type' => 1,
+ 'CODallowed' => 1,
+ ),
+ ),
+ );
+ }
+
+}
Index: modules/in-link/tests/Functional/InLinkUnknownOptionTest.php
===================================================================
--- /dev/null
+++ modules/in-link/tests/Functional/InLinkUnknownOptionTest.php
@@ -0,0 +1,134 @@
+<?php
+
+
+class InLinkUnknownOptionTest extends AbstractUnknownOptionTestCase
+{
+
+ /**
+ * @before
+ */
+ public static function setUpTestBeforeClass()
+ {
+ parent::setUpTestBeforeClass();
+
+ $application =& kApplication::Instance();
+
+ self::$baseItems['lst.first'] = $application->recallObject(
+ 'lst.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['lst.first']->Clear();
+ self::$baseItems['lst.first']->SetDBField('Name', 'UnknownOptionTestBase');
+ self::createBaseItem('lst.first', 'base listing type');
+
+ self::$baseItems['l.first'] = $application->recallObject(
+ 'l.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ self::$baseItems['l.first']->Clear();
+ self::$baseItems['l.first']->SetDBField('l1_Name', 'UnknownOptionTestBase');
+ self::$baseItems['l.first']->SetDBField('Url', 'https://www.in-portal.org/');
+ self::$baseItems['l.first']->SetDBField('CreatedById', USER_ROOT);
+ self::createBaseItem('l.first', 'base link');
+
+ $application->StoreVar('admin', 1);
+ $application->SetVar('m_cat_id', self::$categories[0]->GetID());
+ }
+
+ public function createAndUpdateItemDataProvider()
+ {
+ return array(
+ 'Link validations' => array(
+ 'prefix' => 'link-validation',
+ 'create_hash' => array(
+ 'ValidationCode' => 400,
+ 'ValidationStatus' => 1,
+ ),
+ 'update_hash' => array(
+ 'ValidationCode' => 403,
+ 'ValidationStatus' => '0',
+ ),
+ ),
+ 'Links' => array(
+ 'prefix' => 'l',
+ 'create_hash' => array(
+ 'l1_Name' => 'UnknownOptionTest',
+ 'Url' => 'https://www.in-portal.org/',
+ 'CreatedById' => 'root',
+ 'AutomaticFilename' => '0',
+ 'Status' => 1,
+ 'EditorsPick' => 1,
+ 'HotItem' => 1,
+ 'PopItem' => 1,
+ 'NewItem' => 1,
+ 'ReciprocalLinkFound' => 1,
+ ),
+ 'update_hash' => array(
+ 'AutomaticFilename' => 1,
+ 'Status' => 2,
+ 'EditorsPick' => '0',
+ 'HotItem' => 2,
+ 'PopItem' => 2,
+ 'NewItem' => 2,
+ 'ReciprocalLinkFound' => '0',
+ ),
+ ),
+ 'Listing types' => array(
+ 'prefix' => 'lst',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionTest',
+ 'DurationType' => 3,
+ 'OnPurchaseEdPick' => 1,
+ 'OnPurchaseStatus' => 1,
+ 'OnPurchaseNew' => 1,
+ 'OnPurchasePop' => 1,
+ 'OnPurchaseHot' => 1,
+ 'OnPurchasePriorityAction' => 1,
+ 'OnExpireEdPick' => 1,
+ 'OnExpireNew' => 1,
+ 'OnExpirePop' => 1,
+ 'OnExpireHot' => 1,
+ 'OnExpirePriorityAction' => 1,
+ 'OnExpireStatus' => 1,
+ 'EnableBuying' => '0',
+ 'Recurring' => 1,
+ ),
+ 'update_hash' => array(
+ 'ShopCartName' => 'UnknownOptionTest',
+ 'DurationType' => '',
+ 'OnPurchaseEdPick' => 3,
+ 'OnPurchaseStatus' => 3,
+ 'OnPurchaseNew' => 3,
+ 'OnPurchasePop' => 3,
+ 'OnPurchaseHot' => 3,
+ 'OnPurchasePriorityAction' => 3,
+ 'OnExpireEdPick' => 3,
+ 'OnExpireNew' => 3,
+ 'OnExpirePop' => 3,
+ 'OnExpireHot' => 3,
+ 'OnExpirePriorityAction' => 3,
+ 'OnExpireStatus' => 3,
+ 'EnableBuying' => 1,
+ 'Recurring' => '0',
+ ),
+ ),
+ 'Listings' => array(
+ 'prefix' => 'ls',
+ 'create_hash' => array(
+ 'ListingTypeId' => array('base_item' => array('prefix' => 'lst.first', 'field' => 'Name')),
+ 'ItemResourceId' => array('base_item' => array('prefix' => 'l.first', 'field' => 'ResourceId')),
+ 'Status' => 1,
+ 'PendingRenewal' => 1,
+ ),
+ 'update_hash' => array(
+ 'ListingTypeId' => '',
+ 'Status' => 2,
+ 'PendingRenewal' => '0',
+ ),
+ ),
+ );
+ }
+
+}
Index: modules/in-news/tests/Functional/InNewsUnknownOptionTest.php
===================================================================
--- /dev/null
+++ modules/in-news/tests/Functional/InNewsUnknownOptionTest.php
@@ -0,0 +1,43 @@
+<?php
+
+
+class InNewsUnknownOptionTest extends AbstractUnknownOptionTestCase
+{
+
+ public function createAndUpdateItemDataProvider()
+ {
+ return array(
+ 'Articles' => array(
+ 'prefix' => 'n',
+ 'create_hash' => array(
+ 'Title' => 'UnknownOptionTest',
+ 'Body' => 'UnknownOptionTest',
+ 'CategoryId' => array('cat_0' => 'CategoryId'),
+ 'CreatedById' => 'root',
+ 'AutomaticFilename' => '0',
+ 'Status' => 1,
+ 'EditorsPick' => 1,
+ 'LeadStory' => 1,
+ 'LeadCatStory' => 1,
+ 'HotItem' => 1,
+ 'PopItem' => 1,
+ 'NewItem' => 1,
+ 'Archived' => 1,
+ ),
+ 'update_hash' => array(
+ 'CategoryId' => '',
+ 'AutomaticFilename' => 1,
+ 'Status' => 2,
+ 'EditorsPick' => '0',
+ 'LeadStory' => '0',
+ 'LeadCatStory' => '0',
+ 'HotItem' => 2,
+ 'PopItem' => 2,
+ 'NewItem' => 2,
+ 'Archived' => '',
+ ),
+ ),
+ );
+ }
+
+}
Event Timeline
Log In to Comment