Page MenuHomeIn-Portal Phabricator

unknown_option_tests.patch

File Metadata

Author
erik
Created
Tue, Aug 5, 12:24 PM

unknown_option_tests.patch

Index: core/kernel/application.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/kernel/application.php b/core/kernel/application.php
--- a/core/kernel/application.php (revision 16830)
+++ b/core/kernel/application.php (date 1753810995208)
@@ -798,6 +798,10 @@
$this->registerClass('QAToolsUrlBuilder', KERNEL_PATH . '/tests/Url/QAToolsUrlBuilder.php');
$this->registerClass('QAToolsUrlFactory', KERNEL_PATH . '/tests/Url/QAToolsUrlFactory.php');
$this->registerClass('AbstractTestCase', KERNEL_PATH . '/../tests/Unit/AbstractTestCase.php');
+ $this->registerClass(
+ 'AbstractUnknownOptionTestCase',
+ KERNEL_PATH . '/../tests/Unit/AbstractUnknownOptionTestCase.php'
+ );
$this->registerClass(
'AbstractBrowserTestCase',
KERNEL_PATH . '/../tests/Functional/AbstractBrowserTestCase.php'
Index: core/tests/Unit/AbstractUnknownOptionTestCase.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/tests/Unit/AbstractUnknownOptionTestCase.php b/core/tests/Unit/AbstractUnknownOptionTestCase.php
new file mode 100644
--- /dev/null (date 1754389437366)
+++ b/core/tests/Unit/AbstractUnknownOptionTestCase.php (date 1754389437366)
@@ -0,0 +1,158 @@
+<?php
+
+
+abstract class AbstractUnknownOptionTestCase extends AbstractTestCase
+{
+
+ /**
+ * Base Items.
+ *
+ * @var kDBItem[]
+ */
+ protected $baseItems = array();
+
+ /**
+ * Test Categories
+ *
+ * @var kDBItem[]
+ */
+ protected $categories;
+
+ /**
+ * @before
+ */
+ public function setUpTest()
+ {
+ $this->Conn->Query('BEGIN');
+ $this->Application->isAdmin = true;
+ $this->Application->isAdminUser = true;
+
+ $sql = 'SELECT CategoryId
+ FROM ' . $this->Application->getUnitOption('c', 'TableName') . '
+ LIMIT 0, 2';
+ $category_ids = $this->Conn->GetCol($sql);
+
+ foreach ( $category_ids as $index => $category_id ) {
+ $this->categories[$index] = $this->Application->recallObject(
+ 'c.test' . $category_id,
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->categories[$index]->Load($category_id);
+ }
+ }
+
+ /**
+ * @after
+ */
+ public function tearDownTest()
+ {
+ foreach ( $this->baseItems as $baseItem ) {
+ $this->deleteTestRecord($baseItem);
+ }
+
+ $this->Conn->Query('ROLLBACK');
+ }
+
+ /**
+ * @dataProvider createAndUpdateItemDataProvider
+ */
+ public function testCreateAndUpdateItem(array $test_data)
+ {
+ /** @var kDBItem $object */
+ $object = $this->Application->recallObject($test_data['prefix'], null, array('skip_autoload' => true));
+ $this->prepareObjectForTest($object);
+ $object->Clear();
+ $object->SetFieldsFromHash($this->replaceUnitValues($object, $test_data['create_hash']));
+ $updated = false;
+ $created = $object->Create();
+
+ if ( $created ) {
+ $object->SetFieldsFromHash($this->replaceUnitValues($object, $test_data['update_hash']));
+ $updated = $object->Update();
+ }
+
+ $unknown_option_fields = array();
+
+ if ( !$created || !$updated ) {
+ foreach ( $object->GetFieldErrors() as $field => $error ) {
+ if ( $error['pseudo'] == 'unknown_option' ) {
+ $unknown_option_fields[] = $field;
+ }
+ }
+ }
+
+ $this->assertTrue(
+ $created && $updated,
+ 'unknown_option error in ' . implode(', ', $unknown_option_fields) . ' field(s)'
+ );
+
+ if ( $created ) {
+ $this->deleteTestRecord($object);
+ }
+ }
+
+ /**
+ * Object changes to compensate test environment incompatibilities
+ *
+ * @param kDBItem $object Object.
+ *
+ * @return void
+ */
+ protected function prepareObjectForTest(kDBItem $object)
+ {
+
+ }
+
+ /**
+ * Replaces unit-related values
+ *
+ * @param kDBItem $object Object.
+ * @param array $field_values Field values.
+ *
+ * @return array
+ */
+ protected function replaceUnitValues(kDBItem $object, array $field_values)
+ {
+ $result = $field_values;
+
+ foreach ( $field_values as $field => $value ) {
+ if ( is_array($value) ) {
+ $prefix = key($value);
+
+ if ( substr($prefix, 0, 4) === 'cat_' ) {
+ $result[$field] = $this->categories[substr($prefix, 4)]->GetDBField($value[$prefix]);
+ }
+ elseif ( $prefix === 'self' ) {
+ $field_options = array_keys($object->GetFieldOption($field, 'options'));
+ $option_position = $value[$prefix];
+ $result[$field] = $field_options[$option_position];
+ }
+ elseif ( $prefix === 'base_item' ) {
+ $base_field = $value['base_item']['field'];
+ $base_prefix = $value['base_item']['prefix'];
+ $result[$field] = $this->baseItems[$base_prefix]->GetDBField($base_field);
+ }
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Deletes test record
+ *
+ * @param kDBItem $object Object.
+ *
+ * @return void
+ */
+ protected function deleteTestRecord(kDBItem $object)
+ {
+ $sql = 'DELETE FROM ' . $object->TableName . '
+ WHERE ' . $object->IDField . ' = ' . $object->GetID();
+ $this->Application->Conn->Query($sql);
+ }
+
+ abstract public function createAndUpdateItemDataProvider();
+
+}
Index: modules/in-bulletin/tests/UnknownOptionTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/modules/in-bulletin/tests/UnknownOptionTest.php b/modules/in-bulletin/tests/UnknownOptionTest.php
new file mode 100644
--- /dev/null (date 1754406298188)
+++ b/modules/in-bulletin/tests/UnknownOptionTest.php (date 1754406298188)
@@ -0,0 +1,155 @@
+<?php
+
+
+class UnknownOptionTest extends AbstractUnknownOptionTestCase
+{
+
+ /**
+ * @before
+ */
+ public function setUpTest()
+ {
+ parent::setUpTest();
+
+ $this->baseItems['u.logged'] = $this->Application->recallObject(
+ 'u.logged',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['u.logged']->Clear();
+ $this->baseItems['u.logged']->SetDBField('FirstName', 'Intechnic');
+ $this->baseItems['u.logged']->SetDBField('LastName', 'Tester');
+ $this->baseItems['u.logged']->SetDBField('Password', 'UnknownOptionTest');
+ $this->baseItems['u.logged']->SetDBField('VerifyPassword', 'UnknownOptionTest');
+ $this->baseItems['u.logged']->SetDBField('Password_plain', 'UnknownOptionTest');
+ $this->baseItems['u.logged']->SetDBField('VerifyPassword_plain', 'UnknownOptionTest');
+ $this->baseItems['u.logged']->SetDBField('Email', 'test@in-portal.org');
+ $this->baseItems['u.logged']->Create();
+
+ $this->Application->StoreVar('admin', 1);
+ $this->Application->SetVar('m_cat_id', $this->categories[0]->GetID());
+ $this->Application->StoreVar('user_id', $this->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(
+ array(
+ 'prefix' => 'emoticon',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionTest',
+ 'KeyStroke' => 'AA',
+ 'Enabled' => '0',
+ ),
+ 'update_hash' => array(
+ 'IsPopular' => '0',
+ 'Enabled' => 1,
+ ),
+ ),
+ ),
+ 'Poll answers' => array(
+ array(
+ 'prefix' => 'poll-answer',
+ 'create_hash' => array(
+ 'l1_Answer' => 'UnknownOptionTest',
+ 'Status' => '0',
+ ),
+ 'update_hash' => array(
+ 'Status' => 1,
+ ),
+ ),
+ ),
+ 'Poll comments' => array(
+ 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(
+ 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(
+ 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(
+ 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/Unit/UnknownOptionTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/modules/in-commerce/tests/Unit/UnknownOptionTest.php b/modules/in-commerce/tests/Unit/UnknownOptionTest.php
new file mode 100644
--- /dev/null (date 1754395938873)
+++ b/modules/in-commerce/tests/Unit/UnknownOptionTest.php (date 1754395938873)
@@ -0,0 +1,728 @@
+<?php
+
+
+class UnknownOptionTest extends AbstractUnknownOptionTestCase
+{
+
+ /**
+ * @before
+ */
+ public function setUpTest()
+ {
+ parent::setUpTest();
+
+ $this->baseItems['u.logged'] = $this->Application->recallObject(
+ 'u.logged',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['u.logged']->Clear();
+ $this->baseItems['u.logged']->SetDBField('FirstName', 'Intechnic');
+ $this->baseItems['u.logged']->SetDBField('LastName', 'Tester');
+ $this->baseItems['u.logged']->SetDBField('Password', 'UnknownOptionTest');
+ $this->baseItems['u.logged']->SetDBField('VerifyPassword', 'UnknownOptionTest');
+ $this->baseItems['u.logged']->SetDBField('Password_plain', 'UnknownOptionTest');
+ $this->baseItems['u.logged']->SetDBField('VerifyPassword_plain', 'UnknownOptionTest');
+ $this->baseItems['u.logged']->SetDBField('Email', 'test@in-portal.org');
+ $this->baseItems['u.logged']->Create();
+
+ $this->Application->StoreVar('admin', 1);
+ $this->Application->StoreVar('user_id', $this->baseItems['u.logged']->GetID());
+
+ $this->baseItems['u.second'] = $this->Application->recallObject(
+ 'u.second',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['u.second']->Clear();
+ $this->baseItems['u.second']->SetDBField('FirstName', 'Intechnic');
+ $this->baseItems['u.second']->SetDBField('LastName', 'Developer');
+ $this->baseItems['u.second']->SetDBField('Password', 'UnknownOptionTest2');
+ $this->baseItems['u.second']->SetDBField('VerifyPassword', 'UnknownOptionTest2');
+ $this->baseItems['u.second']->SetDBField('Password_plain', 'UnknownOptionTest2');
+ $this->baseItems['u.second']->SetDBField('VerifyPassword_plain', 'UnknownOptionTest2');
+ $this->baseItems['u.second']->SetDBField('Email', 'dev@in-portal.org');
+ $this->baseItems['u.second']->Create();
+
+ $this->baseItems['u.third'] = $this->Application->recallObject(
+ 'u.third',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['u.third']->Clear();
+ $this->baseItems['u.third']->SetDBField('FirstName', 'Intechnic');
+ $this->baseItems['u.third']->SetDBField('LastName', 'Affiliate');
+ $this->baseItems['u.third']->SetDBField('Password', 'UnknownOptionTest3');
+ $this->baseItems['u.third']->SetDBField('VerifyPassword', 'UnknownOptionTest3');
+ $this->baseItems['u.third']->SetDBField('Password_plain', 'UnknownOptionTest3');
+ $this->baseItems['u.third']->SetDBField('VerifyPassword_plain', 'UnknownOptionTest3');
+ $this->baseItems['u.third']->SetDBField('Email', 'affiliate@in-portal.org');
+ $this->baseItems['u.third']->Create();
+
+ $this->baseItems['apt.first'] = $this->Application->recallObject(
+ 'apt.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['apt.first']->Clear();
+ $this->baseItems['apt.first']->SetDBField('Status', 1);
+ $this->baseItems['apt.first']->SetDBField('Name', 'UnknownOptionsTestBase');
+ $this->baseItems['apt.first']->Create();
+
+ $this->baseItems['apt.second'] = $this->Application->recallObject(
+ 'apt.second',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['apt.second']->Clear();
+ $this->baseItems['apt.second']->SetDBField('Status', 1);
+ $this->baseItems['apt.second']->SetDBField('Name', 'UnknownOptionsTestBase2');
+ $this->baseItems['apt.second']->Create();
+
+ $this->baseItems['ap.first'] = $this->Application->recallObject(
+ 'ap.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['ap.first']->Clear();
+ $this->baseItems['ap.first']->SetDBField('Name', 'UnknownOptionsTestBase');
+ $this->baseItems['ap.first']->SetDBField('Enabled', 1);
+ $this->baseItems['ap.first']->Create();
+
+ $this->baseItems['ap.second'] = $this->Application->recallObject(
+ 'ap.second',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['ap.second']->Clear();
+ $this->baseItems['ap.second']->SetDBField('Name', 'UnknownOptionsTestBase2');
+ $this->baseItems['ap.second']->SetDBField('Enabled', 1);
+ $this->baseItems['ap.second']->Create();
+
+ $this->baseItems['affil.first'] = $this->Application->recallObject(
+ 'affil',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['affil.first']->Clear();
+ $this->baseItems['affil.first']->SetDBField('PortalUserId', $this->baseItems['u.logged']->GetID());
+ $this->baseItems['affil.first']->SetDBField('Status', 1);
+ $this->baseItems['affil.first']->SetDBField('SSN', 'UnknownOptionsTestBase');
+ $this->baseItems['affil.first']->SetDBField('PaymentTypeId', $this->baseItems['apt.first']->GetID());
+ $this->baseItems['affil.first']->SetDBField('AffiliatePlanId', $this->baseItems['ap.first']->GetID());
+ $this->baseItems['affil.first']->Create();
+
+ $this->baseItems['affil.second'] = $this->Application->recallObject(
+ 'affil.second',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['affil.second']->Clear();
+ $this->baseItems['affil.second']->SetDBField('PortalUserId', $this->baseItems['u.second']->GetID());
+ $this->baseItems['affil.second']->SetDBField('Status', 1);
+ $this->baseItems['affil.second']->SetDBField('SSN', 'UnknownOptionsTestBase');
+ $this->baseItems['affil.second']->SetDBField('PaymentTypeId', $this->baseItems['apt.first']->GetID());
+ $this->baseItems['affil.second']->SetDBField('AffiliatePlanId', $this->baseItems['ap.first']->GetID());
+ $this->baseItems['affil.second']->Create();
+
+ $this->baseItems['coup'] = $this->Application->recallObject(
+ 'coup',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['coup']->Clear();
+ $this->baseItems['coup']->SetDBField('Name', 'UnknownOptionsTestBase');
+ $this->baseItems['coup']->SetDBField('Code', 'UnknownOptionsTestBase');
+ $this->baseItems['coup']->Create();
+
+ $this->baseItems['g.first'] = $this->Application->recallObject(
+ 'g.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['g.first']->Clear();
+ $this->baseItems['g.first']->SetDBField('Name', 'UnknownOptionsTestFirst');
+ $this->baseItems['g.first']->Create();
+
+ $this->baseItems['g.second'] = $this->Application->recallObject(
+ 'g.second',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['g.second']->Clear();
+ $this->baseItems['g.second']->SetDBField('Name', 'UnknownOptionsTestSecond');
+ $this->baseItems['g.second']->Create();
+
+ $this->baseItems['d'] = $this->Application->recallObject(
+ 'd',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['d']->Clear();
+ $this->baseItems['d']->SetDBField('Name', 'UnknownOptionsTestBase');
+ $this->baseItems['d']->SetDBField('GroupId', $this->baseItems['g.first']->GetID());
+ $this->baseItems['d']->Create();
+
+ $this->baseItems['manuf.base'] = $this->Application->recallObject(
+ 'manuf.base',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['manuf.base']->Clear();
+ $this->baseItems['manuf.base']->SetDBField('Name', 'UnknownOptionsTestBase');
+ $this->baseItems['manuf.base']->Create();
+
+ $this->baseItems['p'] = $this->Application->recallObject(
+ 'p',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['p']->Clear();
+ $this->baseItems['p']->SetDBField('l1_Name', 'UnknownOptionsTestBase');
+ $this->baseItems['p']->SetDBField('SKU', 'UnknownOptionsTestBase');
+ $this->baseItems['p']->Create();
+
+ $this->baseItems['p-rev'] = $this->Application->recallObject(
+ 'p-rev',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['p-rev']->Clear();
+ $this->baseItems['p-rev']->SetDBField('CreatedById', $this->baseItems['u.logged']->GetID());
+ $this->baseItems['p-rev']->SetDBField('ReviewText', 'UnknownOptionsTestBase');
+ $this->baseItems['p-rev']->SetDBField('ItemId', $this->baseItems['p']->GetDBField('ResourceId'));
+ $this->baseItems['p-rev']->SetDBField('Rating', 3);
+ $this->baseItems['p-rev']->SetDBField('Status', 2);
+ $this->baseItems['p-rev']->Create();
+
+ $this->baseItems['s'] = $this->Application->recallObject(
+ 's',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['s']->Clear();
+ $this->baseItems['s']->SetDBField('Code', 'UnknownOptionsTestBase');
+ $this->baseItems['s']->SetDBField('Name', 'UnknownOptionsTestBase');
+ $this->baseItems['s']->SetDBField('SpeedCode', 'UnknownOptionsTestBase');
+ $this->baseItems['s']->Create();
+
+ $this->baseItems['ord.base'] = $this->Application->recallObject(
+ 'ord.base',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['ord.base']->Clear();
+ $this->baseItems['ord.base']->SetDBField('Number', '234567');
+ $this->baseItems['ord.base']->SetDBField('SubNumber', '00');
+ $this->baseItems['ord.base']->SetDBField('PortalUserId', $this->baseItems['u.logged']->GetID());
+ $this->baseItems['ord.base']->Create();
+ }
+
+ /**
+ * 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(
+ array(
+ 'prefix' => 'manuf',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionTest',
+ 'IsPopular' => 1,
+ 'State' => 'Illinois',
+ 'Country' => 'USA',
+ ),
+ 'update_hash' => array(
+ 'IsPopular' => '0',
+ 'State' => '',
+ 'Country' => '',
+ ),
+ ),
+ ),
+ 'User Addresses' => array(
+ 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(
+ array(
+ 'prefix' => 'apt',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionsTest',
+ 'Status' => 1,
+ 'IsPrimary' => 1,
+ ),
+ 'update_hash' => array(
+ 'Status' => '0',
+ 'IsPrimary' => '0',
+ ),
+ ),
+ ),
+ 'Affiliate payments' => array(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ array(
+ 'prefix' => 'file',
+ 'create_hash' => array(
+ 'FileName' => 'UnknownOptionsTest',
+ 'FilePath' => 'UnknownOptionsTest.txt',
+ 'Status' => 0,
+ ),
+ 'update_hash' => array(
+ 'Status' => 1,
+ ),
+ ),
+ ),
+ 'Reviews' => array(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ 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(
+ array(
+ 'prefix' => 'sqe',
+ 'create_hash' => array(
+ 'ClassName' => 'USPS',
+ 'Status' => 1,
+
+ ),
+ 'update_hash' => array(
+ 'Status' => '0',
+ ),
+ ),
+ ),
+ 'Taxes' => array(
+ 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(
+ array(
+ 'prefix' => 'z',
+ 'create_hash' => array(
+ 'Name' => 'UnknownOptionsTest',
+ 'Type' => 2,
+ 'CODallowed' => '0',
+
+ ),
+ 'update_hash' => array(
+ 'Type' => 1,
+ 'CODallowed' => 1,
+ ),
+ ),
+ ),
+ );
+ }
+
+}
Index: modules/in-link/tests/UnknownOptionTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/modules/in-link/tests/UnknownOptionTest.php b/modules/in-link/tests/UnknownOptionTest.php
new file mode 100644
--- /dev/null (date 1754411905296)
+++ b/modules/in-link/tests/UnknownOptionTest.php (date 1754411905296)
@@ -0,0 +1,140 @@
+<?php
+
+
+class UnknownOptionTest extends AbstractUnknownOptionTestCase
+{
+
+ /**
+ * @before
+ */
+ public function setUpTest()
+ {
+ parent::setUpTest();
+
+ $this->baseItems['lst.first'] = $this->Application->recallObject(
+ 'lst.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['lst.first']->Clear();
+ $this->baseItems['lst.first']->SetDBField('Name', 'UnknownOptionTestBase');
+ $this->baseItems['lst.first']->Create();
+
+ $this->baseItems['l.first'] = $this->Application->recallObject(
+ 'l.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['l.first']->Clear();
+ $this->baseItems['l.first']->SetDBField('l1_Name', 'UnknownOptionTestBase');
+ $this->baseItems['l.first']->SetDBField('Url', 'https://www.in-portal.org/');
+ $this->baseItems['l.first']->SetDBField('CreatedById', USER_ROOT);
+ $this->baseItems['l.first']->Create();
+
+ $this->Application->StoreVar('admin', 1);
+ $this->Application->SetVar('m_cat_id', $this->categories[0]->GetID());
+ }
+
+ public function createAndUpdateItemDataProvider()
+ {
+ return array(
+ 'Link validations' => array(
+ array(
+ 'prefix' => 'link-validation',
+ 'create_hash' => array(
+ 'ValidationCode' => 400,
+ 'ValidationStatus' => 1,
+ ),
+ 'update_hash' => array(
+ 'ValidationCode' => 403,
+ 'ValidationStatus' => '0',
+ ),
+ ),
+ ),
+ 'Links' => array(
+ 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(
+ 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(
+ 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/UnknownOptionTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/modules/in-news/tests/UnknownOptionTest.php b/modules/in-news/tests/UnknownOptionTest.php
new file mode 100644
--- /dev/null (date 1754413650592)
+++ b/modules/in-news/tests/UnknownOptionTest.php (date 1754413650592)
@@ -0,0 +1,76 @@
+<?php
+
+
+class UnknownOptionTest extends AbstractUnknownOptionTestCase
+{
+
+ /**
+ * @before
+ */
+ public function setUpTest()
+ {
+ parent::setUpTest();
+
+/* $this->baseItems['lst.first'] = $this->Application->recallObject(
+ 'lst.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['lst.first']->Clear();
+ $this->baseItems['lst.first']->SetDBField('Name', 'UnknownOptionTestBase');
+ $this->baseItems['lst.first']->Create();
+
+ $this->baseItems['l.first'] = $this->Application->recallObject(
+ 'l.first',
+ null,
+ array('skip_autoload' => true)
+ );
+ $this->baseItems['l.first']->Clear();
+ $this->baseItems['l.first']->SetDBField('l1_Name', 'UnknownOptionTestBase');
+ $this->baseItems['l.first']->SetDBField('Url', 'https://www.in-portal.org/');
+ $this->baseItems['l.first']->SetDBField('CreatedById', USER_ROOT);
+ $this->baseItems['l.first']->Create();
+
+ $this->Application->StoreVar('admin', 1);
+ $this->Application->SetVar('m_cat_id', $this->categories[0]->GetID());*/
+ }
+
+ public function createAndUpdateItemDataProvider()
+ {
+ return array(
+ 'Articles' => array(
+ 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