@@ -2,193 +2,193 @@ |
||
| 2 | 2 | |
| 3 | 3 | class FoxyStripeProductTest extends FunctionalTest { |
| 4 | 4 | |
| 5 | - protected static $use_draft_site = true; |
|
| 5 | + protected static $use_draft_site = true; |
|
| 6 | 6 | |
| 7 | - function setUp(){ |
|
| 7 | + function setUp(){ |
|
| 8 | 8 | |
| 9 | - $groupForItem = OptionGroup::create(); |
|
| 10 | - $groupForItem->Title = 'Sample-Group'; |
|
| 11 | - $groupForItem->write(); |
|
| 9 | + $groupForItem = OptionGroup::create(); |
|
| 10 | + $groupForItem->Title = 'Sample-Group'; |
|
| 11 | + $groupForItem->write(); |
|
| 12 | 12 | |
| 13 | - $productHolder = ProductHolder::create(); |
|
| 14 | - $productHolder->Title = 'Product Holder'; |
|
| 15 | - $productHolder->write(); |
|
| 16 | - } |
|
| 13 | + $productHolder = ProductHolder::create(); |
|
| 14 | + $productHolder->Title = 'Product Holder'; |
|
| 15 | + $productHolder->write(); |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - function testProductCreation(){ |
|
| 18 | + function testProductCreation(){ |
|
| 19 | 19 | |
| 20 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 21 | - $default = $this->objFromFixture('ProductCategory', 'default'); |
|
| 22 | - $default->write(); |
|
| 23 | - $product1 = $this->objFromFixture('FoxyStripeProduct', 'product1'); |
|
| 24 | - $product1->ParentID = ProductHolder::get()->first()->ID; |
|
| 20 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 21 | + $default = $this->objFromFixture('ProductCategory', 'default'); |
|
| 22 | + $default->write(); |
|
| 23 | + $product1 = $this->objFromFixture('FoxyStripeProduct', 'product1'); |
|
| 24 | + $product1->ParentID = ProductHolder::get()->first()->ID; |
|
| 25 | 25 | |
| 26 | - $product1->doPublish(); |
|
| 27 | - $this->assertTrue($product1->isPublished()); |
|
| 26 | + $product1->doPublish(); |
|
| 27 | + $this->assertTrue($product1->isPublished()); |
|
| 28 | 28 | |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - function testProductDeletion(){ |
|
| 31 | + function testProductDeletion(){ |
|
| 32 | 32 | |
| 33 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 34 | - $product2 = $this->objFromFixture('FoxyStripeProduct', 'product2'); |
|
| 35 | - $product2->ParentID = ProductHolder::get()->first()->ID; |
|
| 36 | - $productID = $product2->ID; |
|
| 33 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 34 | + $product2 = $this->objFromFixture('FoxyStripeProduct', 'product2'); |
|
| 35 | + $product2->ParentID = ProductHolder::get()->first()->ID; |
|
| 36 | + $productID = $product2->ID; |
|
| 37 | 37 | |
| 38 | - $product2->doPublish(); |
|
| 39 | - $this->assertTrue($product2->isPublished()); |
|
| 38 | + $product2->doPublish(); |
|
| 39 | + $this->assertTrue($product2->isPublished()); |
|
| 40 | 40 | |
| 41 | - $versions = DB::query('Select * FROM "FoxyStripeProduct_versions" WHERE "RecordID" = '. $productID); |
|
| 42 | - $versionsPostPublish = array(); |
|
| 43 | - foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 41 | + $versions = DB::query('Select * FROM "FoxyStripeProduct_versions" WHERE "RecordID" = '. $productID); |
|
| 42 | + $versionsPostPublish = array(); |
|
| 43 | + foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 44 | 44 | |
| 45 | - $product2->delete(); |
|
| 46 | - $this->assertTrue(!$product2->isPublished()); |
|
| 45 | + $product2->delete(); |
|
| 46 | + $this->assertTrue(!$product2->isPublished()); |
|
| 47 | 47 | |
| 48 | - $versions = DB::query('Select * FROM "FoxyStripeProduct_versions" WHERE "RecordID" = '. $productID); |
|
| 49 | - $versionsPostDelete = array(); |
|
| 50 | - foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 48 | + $versions = DB::query('Select * FROM "FoxyStripeProduct_versions" WHERE "RecordID" = '. $productID); |
|
| 49 | + $versionsPostDelete = array(); |
|
| 50 | + foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 51 | 51 | |
| 52 | - $this->assertTrue($versionsPostPublish == $versionsPostDelete); |
|
| 52 | + $this->assertTrue($versionsPostPublish == $versionsPostDelete); |
|
| 53 | 53 | |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - function testProductTitleLeadingWhiteSpace(){ |
|
| 56 | + function testProductTitleLeadingWhiteSpace(){ |
|
| 57 | 57 | |
| 58 | - $this->logInWithPermission('ADMIN'); |
|
| 59 | - $product = $this->objFromFixture('FoxyStripeProduct', 'product1'); |
|
| 60 | - $product->Title = " Test with leading space"; |
|
| 61 | - $product->ParentID = ProductHolder::get()->first()->ID; |
|
| 62 | - $product->doPublish(); |
|
| 58 | + $this->logInWithPermission('ADMIN'); |
|
| 59 | + $product = $this->objFromFixture('FoxyStripeProduct', 'product1'); |
|
| 60 | + $product->Title = " Test with leading space"; |
|
| 61 | + $product->ParentID = ProductHolder::get()->first()->ID; |
|
| 62 | + $product->doPublish(); |
|
| 63 | 63 | |
| 64 | - $this->assertTrue($product->Title == 'Test with leading space'); |
|
| 64 | + $this->assertTrue($product->Title == 'Test with leading space'); |
|
| 65 | 65 | |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - function testProductTitleTrailingWhiteSpace(){ |
|
| 68 | + function testProductTitleTrailingWhiteSpace(){ |
|
| 69 | 69 | |
| 70 | - $this->logInWithPermission('ADMIN'); |
|
| 71 | - $product = $this->objFromFixture('FoxyStripeProduct', 'product1'); |
|
| 72 | - $product->Title = "Test with trailing space "; |
|
| 73 | - $product->ParentID = ProductHolder::get()->first()->ID; |
|
| 74 | - $product->doPublish(); |
|
| 70 | + $this->logInWithPermission('ADMIN'); |
|
| 71 | + $product = $this->objFromFixture('FoxyStripeProduct', 'product1'); |
|
| 72 | + $product->Title = "Test with trailing space "; |
|
| 73 | + $product->ParentID = ProductHolder::get()->first()->ID; |
|
| 74 | + $product->doPublish(); |
|
| 75 | 75 | |
| 76 | - $this->assertTrue($product->Title == 'Test with trailing space'); |
|
| 76 | + $this->assertTrue($product->Title == 'Test with trailing space'); |
|
| 77 | 77 | |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - function testProductCategoryCreation(){ |
|
| 80 | + function testProductCategoryCreation(){ |
|
| 81 | 81 | |
| 82 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 83 | - $category = $this->objFromFixture('ProductCategory', 'apparel'); |
|
| 84 | - $category->write(); |
|
| 85 | - $categoryID = $category->ID; |
|
| 82 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 83 | + $category = $this->objFromFixture('ProductCategory', 'apparel'); |
|
| 84 | + $category->write(); |
|
| 85 | + $categoryID = $category->ID; |
|
| 86 | 86 | |
| 87 | - $productCategory = ProductCategory::get()->filter(array('Code'=>'APPAREL'))->first(); |
|
| 87 | + $productCategory = ProductCategory::get()->filter(array('Code'=>'APPAREL'))->first(); |
|
| 88 | 88 | |
| 89 | - $this->assertTrue($categoryID == $productCategory->ID); |
|
| 89 | + $this->assertTrue($categoryID == $productCategory->ID); |
|
| 90 | 90 | |
| 91 | - } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - function testProductCategoryDeletion(){ |
|
| 93 | + function testProductCategoryDeletion(){ |
|
| 94 | 94 | |
| 95 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 96 | - $category = $this->objFromFixture('ProductCategory', 'default'); |
|
| 97 | - $category->write(); |
|
| 95 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 96 | + $category = $this->objFromFixture('ProductCategory', 'default'); |
|
| 97 | + $category->write(); |
|
| 98 | 98 | |
| 99 | - $this->assertFalse($category->canDelete()); |
|
| 99 | + $this->assertFalse($category->canDelete()); |
|
| 100 | 100 | |
| 101 | - $category2 = $this->objFromFixture('ProductCategory', 'apparel'); |
|
| 102 | - $category2->write(); |
|
| 103 | - $category2ID = $category2->ID; |
|
| 101 | + $category2 = $this->objFromFixture('ProductCategory', 'apparel'); |
|
| 102 | + $category2->write(); |
|
| 103 | + $category2ID = $category2->ID; |
|
| 104 | 104 | |
| 105 | - $this->assertTrue($category2->canDelete()); |
|
| 105 | + $this->assertTrue($category2->canDelete()); |
|
| 106 | 106 | |
| 107 | - $this->logOut(); |
|
| 107 | + $this->logOut(); |
|
| 108 | 108 | |
| 109 | - $this->logInWithPermission('ADMIN'); |
|
| 109 | + $this->logInWithPermission('ADMIN'); |
|
| 110 | 110 | |
| 111 | - $this->assertFalse($category->canDelete()); |
|
| 112 | - $this->assertTrue($category2->canDelete()); |
|
| 111 | + $this->assertFalse($category->canDelete()); |
|
| 112 | + $this->assertTrue($category2->canDelete()); |
|
| 113 | 113 | |
| 114 | - $this->logOut(); |
|
| 115 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 114 | + $this->logOut(); |
|
| 115 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 116 | 116 | |
| 117 | - $category2->delete(); |
|
| 117 | + $category2->delete(); |
|
| 118 | 118 | |
| 119 | - $this->assertFalse(in_array($category2ID,FoxyCartProductCategory::get()->column('ID'))); |
|
| 119 | + $this->assertFalse(in_array($category2ID,FoxyCartProductCategory::get()->column('ID'))); |
|
| 120 | 120 | |
| 121 | - } |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - function testOptionGroupCreation(){ |
|
| 123 | + function testOptionGroupCreation(){ |
|
| 124 | 124 | |
| 125 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 126 | - $group = $this->objFromFixture('OptionGroup', 'size'); |
|
| 127 | - $group->write(); |
|
| 125 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 126 | + $group = $this->objFromFixture('OptionGroup', 'size'); |
|
| 127 | + $group->write(); |
|
| 128 | 128 | |
| 129 | - $this->assertNotNull(OptionGroup::get()->first()); |
|
| 129 | + $this->assertNotNull(OptionGroup::get()->first()); |
|
| 130 | 130 | |
| 131 | - } |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - function testOptionGroupDeletion(){ |
|
| 133 | + function testOptionGroupDeletion(){ |
|
| 134 | 134 | |
| 135 | - $this->logInWithPermission('ADMIN'); |
|
| 136 | - $group = $this->objFromFixture('OptionGroup', 'color'); |
|
| 137 | - $group->write(); |
|
| 138 | - $groupID = $group->ID; |
|
| 135 | + $this->logInWithPermission('ADMIN'); |
|
| 136 | + $group = $this->objFromFixture('OptionGroup', 'color'); |
|
| 137 | + $group->write(); |
|
| 138 | + $groupID = $group->ID; |
|
| 139 | 139 | |
| 140 | - $this->assertTrue($group->canDelete()); |
|
| 140 | + $this->assertTrue($group->canDelete()); |
|
| 141 | 141 | |
| 142 | - $this->logOut(); |
|
| 143 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 142 | + $this->logOut(); |
|
| 143 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 144 | 144 | |
| 145 | - $this->assertTrue($group->canDelete()); |
|
| 146 | - $group->delete(); |
|
| 145 | + $this->assertTrue($group->canDelete()); |
|
| 146 | + $group->delete(); |
|
| 147 | 147 | |
| 148 | - $this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID'))); |
|
| 148 | + $this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID'))); |
|
| 149 | 149 | |
| 150 | - } |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - function testOptionItemCreation(){ |
|
| 152 | + function testOptionItemCreation(){ |
|
| 153 | 153 | |
| 154 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 155 | - $optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first(); |
|
| 156 | - $option = $this->objFromFixture('OptionItem', 'large'); |
|
| 157 | - $option->ProductOptionGroupID = $optionGroup->ID; |
|
| 158 | - $option->write(); |
|
| 159 | - $optionID = $option->ID; |
|
| 154 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 155 | + $optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first(); |
|
| 156 | + $option = $this->objFromFixture('OptionItem', 'large'); |
|
| 157 | + $option->ProductOptionGroupID = $optionGroup->ID; |
|
| 158 | + $option->write(); |
|
| 159 | + $optionID = $option->ID; |
|
| 160 | 160 | |
| 161 | - $optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first(); |
|
| 161 | + $optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first(); |
|
| 162 | 162 | |
| 163 | - $this->assertEquals($optionID, $optionItem->ID); |
|
| 163 | + $this->assertEquals($optionID, $optionItem->ID); |
|
| 164 | 164 | |
| 165 | - } |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | - function testOptionItemDeletion(){ |
|
| 167 | + function testOptionItemDeletion(){ |
|
| 168 | 168 | |
| 169 | - $this->logInWithPermission('ADMIN'); |
|
| 170 | - $optionGroup = (OptionGroup::get()->first()) |
|
| 171 | - ? OptionGroup::get()->first() |
|
| 172 | - : OptionGroup::create(); |
|
| 173 | - if($optionGroup->ID == 0){ |
|
| 174 | - $optionGroup->Title = 'Size'; |
|
| 175 | - $optionGroup->write(); |
|
| 176 | - } |
|
| 177 | - $option = $this->objFromFixture('OptionItem', 'small'); |
|
| 178 | - $option->ProductOptionGroupID = $optionGroup->ID; |
|
| 179 | - $option->write(); |
|
| 180 | - $optionID = $option->ID; |
|
| 169 | + $this->logInWithPermission('ADMIN'); |
|
| 170 | + $optionGroup = (OptionGroup::get()->first()) |
|
| 171 | + ? OptionGroup::get()->first() |
|
| 172 | + : OptionGroup::create(); |
|
| 173 | + if($optionGroup->ID == 0){ |
|
| 174 | + $optionGroup->Title = 'Size'; |
|
| 175 | + $optionGroup->write(); |
|
| 176 | + } |
|
| 177 | + $option = $this->objFromFixture('OptionItem', 'small'); |
|
| 178 | + $option->ProductOptionGroupID = $optionGroup->ID; |
|
| 179 | + $option->write(); |
|
| 180 | + $optionID = $option->ID; |
|
| 181 | 181 | |
| 182 | - $this->assertTrue($option->canDelete()); |
|
| 182 | + $this->assertTrue($option->canDelete()); |
|
| 183 | 183 | |
| 184 | - $this->logOut(); |
|
| 185 | - $this->logInWithPermission('Product_CANCRUD'); |
|
| 184 | + $this->logOut(); |
|
| 185 | + $this->logInWithPermission('Product_CANCRUD'); |
|
| 186 | 186 | |
| 187 | - $this->assertTrue($option->canDelete()); |
|
| 188 | - $option->delete(); |
|
| 187 | + $this->assertTrue($option->canDelete()); |
|
| 188 | + $option->delete(); |
|
| 189 | 189 | |
| 190 | - $this->assertFalse(in_array($optionID, OptionItem::get()->column('ID'))); |
|
| 190 | + $this->assertFalse(in_array($optionID, OptionItem::get()->column('ID'))); |
|
| 191 | 191 | |
| 192 | - } |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | 194 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | protected static $use_draft_site = true; |
| 6 | 6 | |
| 7 | - function setUp(){ |
|
| 7 | + function setUp() { |
|
| 8 | 8 | |
| 9 | 9 | $groupForItem = OptionGroup::create(); |
| 10 | 10 | $groupForItem->Title = 'Sample-Group'; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $productHolder->write(); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - function testProductCreation(){ |
|
| 18 | + function testProductCreation() { |
|
| 19 | 19 | |
| 20 | 20 | $this->logInWithPermission('Product_CANCRUD'); |
| 21 | 21 | $default = $this->objFromFixture('ProductCategory', 'default'); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - function testProductDeletion(){ |
|
| 31 | + function testProductDeletion() { |
|
| 32 | 32 | |
| 33 | 33 | $this->logInWithPermission('Product_CANCRUD'); |
| 34 | 34 | $product2 = $this->objFromFixture('FoxyStripeProduct', 'product2'); |
@@ -38,22 +38,22 @@ discard block |
||
| 38 | 38 | $product2->doPublish(); |
| 39 | 39 | $this->assertTrue($product2->isPublished()); |
| 40 | 40 | |
| 41 | - $versions = DB::query('Select * FROM "FoxyStripeProduct_versions" WHERE "RecordID" = '. $productID); |
|
| 41 | + $versions = DB::query('Select * FROM "FoxyStripeProduct_versions" WHERE "RecordID" = '.$productID); |
|
| 42 | 42 | $versionsPostPublish = array(); |
| 43 | - foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 43 | + foreach ($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 44 | 44 | |
| 45 | 45 | $product2->delete(); |
| 46 | 46 | $this->assertTrue(!$product2->isPublished()); |
| 47 | 47 | |
| 48 | - $versions = DB::query('Select * FROM "FoxyStripeProduct_versions" WHERE "RecordID" = '. $productID); |
|
| 48 | + $versions = DB::query('Select * FROM "FoxyStripeProduct_versions" WHERE "RecordID" = '.$productID); |
|
| 49 | 49 | $versionsPostDelete = array(); |
| 50 | - foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 50 | + foreach ($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 51 | 51 | |
| 52 | 52 | $this->assertTrue($versionsPostPublish == $versionsPostDelete); |
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - function testProductTitleLeadingWhiteSpace(){ |
|
| 56 | + function testProductTitleLeadingWhiteSpace() { |
|
| 57 | 57 | |
| 58 | 58 | $this->logInWithPermission('ADMIN'); |
| 59 | 59 | $product = $this->objFromFixture('FoxyStripeProduct', 'product1'); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - function testProductTitleTrailingWhiteSpace(){ |
|
| 68 | + function testProductTitleTrailingWhiteSpace() { |
|
| 69 | 69 | |
| 70 | 70 | $this->logInWithPermission('ADMIN'); |
| 71 | 71 | $product = $this->objFromFixture('FoxyStripeProduct', 'product1'); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - function testProductCategoryCreation(){ |
|
| 80 | + function testProductCategoryCreation() { |
|
| 81 | 81 | |
| 82 | 82 | $this->logInWithPermission('Product_CANCRUD'); |
| 83 | 83 | $category = $this->objFromFixture('ProductCategory', 'apparel'); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - function testProductCategoryDeletion(){ |
|
| 93 | + function testProductCategoryDeletion() { |
|
| 94 | 94 | |
| 95 | 95 | $this->logInWithPermission('Product_CANCRUD'); |
| 96 | 96 | $category = $this->objFromFixture('ProductCategory', 'default'); |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $category2->delete(); |
| 118 | 118 | |
| 119 | - $this->assertFalse(in_array($category2ID,FoxyCartProductCategory::get()->column('ID'))); |
|
| 119 | + $this->assertFalse(in_array($category2ID, FoxyCartProductCategory::get()->column('ID'))); |
|
| 120 | 120 | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - function testOptionGroupCreation(){ |
|
| 123 | + function testOptionGroupCreation() { |
|
| 124 | 124 | |
| 125 | 125 | $this->logInWithPermission('Product_CANCRUD'); |
| 126 | 126 | $group = $this->objFromFixture('OptionGroup', 'size'); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - function testOptionGroupDeletion(){ |
|
| 133 | + function testOptionGroupDeletion() { |
|
| 134 | 134 | |
| 135 | 135 | $this->logInWithPermission('ADMIN'); |
| 136 | 136 | $group = $this->objFromFixture('OptionGroup', 'color'); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - function testOptionItemCreation(){ |
|
| 152 | + function testOptionItemCreation() { |
|
| 153 | 153 | |
| 154 | 154 | $this->logInWithPermission('Product_CANCRUD'); |
| 155 | 155 | $optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first(); |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - function testOptionItemDeletion(){ |
|
| 167 | + function testOptionItemDeletion() { |
|
| 168 | 168 | |
| 169 | 169 | $this->logInWithPermission('ADMIN'); |
| 170 | 170 | $optionGroup = (OptionGroup::get()->first()) |
| 171 | 171 | ? OptionGroup::get()->first() |
| 172 | 172 | : OptionGroup::create(); |
| 173 | - if($optionGroup->ID == 0){ |
|
| 173 | + if ($optionGroup->ID == 0) { |
|
| 174 | 174 | $optionGroup->Title = 'Size'; |
| 175 | 175 | $optionGroup->write(); |
| 176 | 176 | } |
@@ -41,14 +41,18 @@ |
||
| 41 | 41 | |
| 42 | 42 | $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); |
| 43 | 43 | $versionsPostPublish = array(); |
| 44 | - foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 44 | + foreach($versions as $versionRow) { |
|
| 45 | + $versionsPostPublish[] = $versionRow; |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $product2->delete(); |
| 47 | 49 | $this->assertTrue(!$product2->isPublished()); |
| 48 | 50 | |
| 49 | 51 | $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); |
| 50 | 52 | $versionsPostDelete = array(); |
| 51 | - foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 53 | + foreach($versions as $versionRow) { |
|
| 54 | + $versionsPostDelete[] = $versionRow; |
|
| 55 | + } |
|
| 52 | 56 | |
| 53 | 57 | $this->assertTrue($versionsPostPublish == $versionsPostDelete); |
| 54 | 58 | |