@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | // get FoxyCart Store Name for JS call |
| 6 | 6 | public function getCartScript() { |
| 7 | - return '<script src="https://cdn.foxycart.com/' . FoxyCart::getFoxyCartStoreName() . '/loader.js" async defer></script>'; |
|
| 7 | + return '<script src="https://cdn.foxycart.com/'.FoxyCart::getFoxyCartStoreName().'/loader.js" async defer></script>'; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | } |
| 11 | 11 | \ No newline at end of file |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class ProductPageTest extends FS_Test{ |
|
| 3 | +class ProductPageTest extends FS_Test { |
|
| 4 | 4 | |
| 5 | 5 | protected static $use_draft_site = true; |
| 6 | 6 | |
| 7 | - function setUp(){ |
|
| 7 | + function setUp() { |
|
| 8 | 8 | parent::setUp(); |
| 9 | 9 | |
| 10 | 10 | $groupForItem = OptionGroup::create(); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $productHolder->write();*/ |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - function testProductCreation(){ |
|
| 19 | + function testProductCreation() { |
|
| 20 | 20 | |
| 21 | 21 | $this->logInWithPermission('Product_CANCRUD'); |
| 22 | 22 | $default = $this->objFromFixture('ProductCategory', 'default'); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - function testProductDeletion(){ |
|
| 34 | + function testProductDeletion() { |
|
| 35 | 35 | |
| 36 | 36 | $this->logInWithPermission('Product_CANCRUD'); |
| 37 | 37 | $holder = $this->objFromFixture('ProductHolder', 'holder'); |
@@ -42,22 +42,22 @@ discard block |
||
| 42 | 42 | $product2->doPublish(); |
| 43 | 43 | $this->assertTrue($product2->isPublished()); |
| 44 | 44 | |
| 45 | - $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); |
|
| 45 | + $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '.$productID); |
|
| 46 | 46 | $versionsPostPublish = array(); |
| 47 | - foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 47 | + foreach ($versions as $versionRow) $versionsPostPublish[] = $versionRow; |
|
| 48 | 48 | |
| 49 | 49 | $product2->delete(); |
| 50 | 50 | $this->assertTrue(!$product2->isPublished()); |
| 51 | 51 | |
| 52 | - $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); |
|
| 52 | + $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '.$productID); |
|
| 53 | 53 | $versionsPostDelete = array(); |
| 54 | - foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 54 | + foreach ($versions as $versionRow) $versionsPostDelete[] = $versionRow; |
|
| 55 | 55 | |
| 56 | 56 | $this->assertTrue($versionsPostPublish == $versionsPostDelete); |
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - function testProductTitleLeadingWhiteSpace(){ |
|
| 60 | + function testProductTitleLeadingWhiteSpace() { |
|
| 61 | 61 | |
| 62 | 62 | $this->logInWithPermission('ADMIN'); |
| 63 | 63 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - function testProductTitleTrailingWhiteSpace(){ |
|
| 75 | + function testProductTitleTrailingWhiteSpace() { |
|
| 76 | 76 | |
| 77 | 77 | $this->logInWithPermission('ADMIN'); |
| 78 | 78 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - function testProductCategoryCreation(){ |
|
| 90 | + function testProductCategoryCreation() { |
|
| 91 | 91 | |
| 92 | 92 | $this->logInWithPermission('Product_CANCRUD'); |
| 93 | 93 | $category = $this->objFromFixture('ProductCategory', 'apparel'); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - function testProductCategoryDeletion(){ |
|
| 103 | + function testProductCategoryDeletion() { |
|
| 104 | 104 | |
| 105 | 105 | $this->logInWithPermission('Product_CANCRUD'); |
| 106 | 106 | |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | $category2->delete(); |
| 129 | 129 | |
| 130 | - $this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID'))); |
|
| 130 | + $this->assertFalse(in_array($category2ID, ProductCategory::get()->column('ID'))); |
|
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - function testOptionGroupCreation(){ |
|
| 134 | + function testOptionGroupCreation() { |
|
| 135 | 135 | |
| 136 | 136 | $this->logInWithPermission('Product_CANCRUD'); |
| 137 | 137 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - function testOptionGroupDeletion(){ |
|
| 145 | + function testOptionGroupDeletion() { |
|
| 146 | 146 | |
| 147 | 147 | $this->logInWithPermission('ADMIN'); |
| 148 | 148 | $group = $this->objFromFixture('OptionGroup', 'color'); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - function testOptionItemCreation(){ |
|
| 164 | + function testOptionItemCreation() { |
|
| 165 | 165 | |
| 166 | 166 | $this->logInWithPermission('Product_CANCRUD'); |
| 167 | 167 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - function testOptionItemDeletion(){ |
|
| 182 | + function testOptionItemDeletion() { |
|
| 183 | 183 | |
| 184 | 184 | $this->logInWithPermission('ADMIN'); |
| 185 | 185 | |
@@ -203,45 +203,45 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - public function testProductDraftOptionDeletion(){ |
|
| 206 | + public function testProductDraftOptionDeletion() { |
|
| 207 | 207 | |
| 208 | - self::$use_draft_site = false;//make sure we can publish |
|
| 208 | + self::$use_draft_site = false; //make sure we can publish |
|
| 209 | 209 | |
| 210 | 210 | $this->logInWithPermission('ADMIN'); |
| 211 | 211 | |
| 212 | - $holder = $this->objFromFixture('ProductHolder', 'holder');//build holder page, ProductPage can't be on root level |
|
| 212 | + $holder = $this->objFromFixture('ProductHolder', 'holder'); //build holder page, ProductPage can't be on root level |
|
| 213 | 213 | $holder->doPublish(); |
| 214 | 214 | |
| 215 | - $product = $this->objFromFixture('ProductPage', 'product1');//build product page |
|
| 215 | + $product = $this->objFromFixture('ProductPage', 'product1'); //build product page |
|
| 216 | 216 | $product->doPublish(); |
| 217 | 217 | |
| 218 | 218 | $productID = $product->ID; |
| 219 | 219 | |
| 220 | 220 | |
| 221 | - $optionGroup = $this->objFromFixture('OptionGroup', 'size');//build the group for the options |
|
| 221 | + $optionGroup = $this->objFromFixture('OptionGroup', 'size'); //build the group for the options |
|
| 222 | 222 | $optionGroup->write(); |
| 223 | - $option = $this->objFromFixture('OptionItem', 'small');//build first option |
|
| 223 | + $option = $this->objFromFixture('OptionItem', 'small'); //build first option |
|
| 224 | 224 | $option->write(); |
| 225 | - $option2 = $this->objFromFixture('OptionItem', 'large');//build second option |
|
| 225 | + $option2 = $this->objFromFixture('OptionItem', 'large'); //build second option |
|
| 226 | 226 | $option2->write(); |
| 227 | 227 | |
| 228 | - $this->assertTrue($product->isPublished());//check that product is published |
|
| 228 | + $this->assertTrue($product->isPublished()); //check that product is published |
|
| 229 | 229 | |
| 230 | - $product->deleteFromStage('Stage');//remove product from draft site |
|
| 230 | + $product->deleteFromStage('Stage'); //remove product from draft site |
|
| 231 | 231 | |
| 232 | - $this->assertTrue($product->isPublished());//check product is still published |
|
| 232 | + $this->assertTrue($product->isPublished()); //check product is still published |
|
| 233 | 233 | |
| 234 | 234 | $testOption = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first(); |
| 235 | 235 | |
| 236 | - $this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0)));//make sure the first option still exists |
|
| 236 | + $this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0))); //make sure the first option still exists |
|
| 237 | 237 | |
| 238 | - $product->doRestoreToStage();//restore page to draft site |
|
| 239 | - $product->doUnpublish();//unpublish page |
|
| 240 | - $product->deleteFromStage('Stage');//remove product from draft site |
|
| 238 | + $product->doRestoreToStage(); //restore page to draft site |
|
| 239 | + $product->doUnpublish(); //unpublish page |
|
| 240 | + $product->deleteFromStage('Stage'); //remove product from draft site |
|
| 241 | 241 | |
| 242 | - $checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first();//query same option as above |
|
| 242 | + $checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first(); //query same option as above |
|
| 243 | 243 | |
| 244 | - $this->assertEquals($checkDeleted->ID, 0);//check that the ID is 0 (empty object/non-existent) |
|
| 244 | + $this->assertEquals($checkDeleted->ID, 0); //check that the ID is 0 (empty object/non-existent) |
|
| 245 | 245 | |
| 246 | 246 | } |
| 247 | 247 | |