Completed
Push — master ( 3228c3...282357 )
by Jason
14:05
created
code/form/FoxyStripeDropdownField.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -50,39 +50,39 @@
 block discarded – undo
50 50
  */
51 51
 class FoxyStripeDropdownField extends DropdownField{
52 52
 
53
-	/**
54
-	 * Mark certain elements as disabled,
55
-	 * regardless of the {@link setDisabled()} settings.
56
-	 *
57
-	 * @param array $items Collection of array keys, as defined in the $source array
58
-	 */
59
-	public function setDisabledItems($items){
60
-		$controller = Controller::curr();
61
-		$code = $controller->data()->Code;
62
-		$updated = [];
63
-		if(is_array($items) && !empty($items)){
64
-			foreach($items as $item){
65
-				array_push($updated, ProductPage::getGeneratedValue($code, $this->getName(), $item, 'value'));
66
-			}
67
-		}
68
-		$this->disabledItems = $updated;
69
-		return $this;
70
-	}
53
+    /**
54
+     * Mark certain elements as disabled,
55
+     * regardless of the {@link setDisabled()} settings.
56
+     *
57
+     * @param array $items Collection of array keys, as defined in the $source array
58
+     */
59
+    public function setDisabledItems($items){
60
+        $controller = Controller::curr();
61
+        $code = $controller->data()->Code;
62
+        $updated = [];
63
+        if(is_array($items) && !empty($items)){
64
+            foreach($items as $item){
65
+                array_push($updated, ProductPage::getGeneratedValue($code, $this->getName(), $item, 'value'));
66
+            }
67
+        }
68
+        $this->disabledItems = $updated;
69
+        return $this;
70
+    }
71 71
 
72
-	/**
73
-	 * @param array $source
74
-	 */
75
-	public function setSource($source) {
76
-		$controller = Controller::curr();
77
-		$code = $controller->data()->Code;
78
-		$updated = [];
79
-		if(is_array($source) && !empty($source)){
80
-			foreach($source as $key => $val){
81
-				$updated[ProductPage::getGeneratedValue($code, $this->getName(), $key, 'value')] = $val;
82
-			}
83
-		}
84
-		$this->source = $updated;
85
-		return $this;
86
-	}
72
+    /**
73
+     * @param array $source
74
+     */
75
+    public function setSource($source) {
76
+        $controller = Controller::curr();
77
+        $code = $controller->data()->Code;
78
+        $updated = [];
79
+        if(is_array($source) && !empty($source)){
80
+            foreach($source as $key => $val){
81
+                $updated[ProductPage::getGeneratedValue($code, $this->getName(), $key, 'value')] = $val;
82
+            }
83
+        }
84
+        $this->source = $updated;
85
+        return $this;
86
+    }
87 87
 
88 88
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  * @package forms
49 49
  * @subpackage fields-basic
50 50
  */
51
-class FoxyStripeDropdownField extends DropdownField{
51
+class FoxyStripeDropdownField extends DropdownField {
52 52
 
53 53
 	/**
54 54
 	 * Mark certain elements as disabled,
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @param array $items Collection of array keys, as defined in the $source array
58 58
 	 */
59
-	public function setDisabledItems($items){
59
+	public function setDisabledItems($items) {
60 60
 		$controller = Controller::curr();
61 61
 		$code = $controller->data()->Code;
62 62
 		$updated = [];
63
-		if(is_array($items) && !empty($items)){
64
-			foreach($items as $item){
63
+		if (is_array($items) && !empty($items)) {
64
+			foreach ($items as $item) {
65 65
 				array_push($updated, ProductPage::getGeneratedValue($code, $this->getName(), $item, 'value'));
66 66
 			}
67 67
 		}
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 		$controller = Controller::curr();
77 77
 		$code = $controller->data()->Code;
78 78
 		$updated = [];
79
-		if(is_array($source) && !empty($source)){
80
-			foreach($source as $key => $val){
79
+		if (is_array($source) && !empty($source)) {
80
+			foreach ($source as $key => $val) {
81 81
 				$updated[ProductPage::getGeneratedValue($code, $this->getName(), $key, 'value')] = $val;
82 82
 			}
83 83
 		}
Please login to merge, or discard this patch.
code/extensions/CustomerExtension.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@
 block discarded – undo
25 25
         $response = FoxyCart::putCustomer($this->owner);
26 26
 
27 27
         // Grab customer_id record from FoxyCart response, store in Member
28
-		if($response){
29
-        	$foxyResponse = new SimpleXMLElement($response);
30
-        	$this->owner->Customer_ID = (int) $foxyResponse->customer_id;
31
-		}
28
+        if($response){
29
+            $foxyResponse = new SimpleXMLElement($response);
30
+            $this->owner->Customer_ID = (int) $foxyResponse->customer_id;
31
+        }
32 32
     }
33 33
 
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class CustomerExtension extends DataExtension{
3
+class CustomerExtension extends DataExtension {
4 4
 
5 5
     private static $db = array(
6 6
         'Customer_ID' => 'Int'
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
         $response = FoxyCart::putCustomer($this->owner);
26 26
 
27 27
         // Grab customer_id record from FoxyCart response, store in Member
28
-		if($response){
28
+		if ($response) {
29 29
         	$foxyResponse = new SimpleXMLElement($response);
30
-        	$this->owner->Customer_ID = (int) $foxyResponse->customer_id;
30
+        	$this->owner->Customer_ID = (int)$foxyResponse->customer_id;
31 31
 		}
32 32
     }
33 33
 
Please login to merge, or discard this patch.
tests/StoreSettingsTest.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -2,30 +2,30 @@
 block discarded – undo
2 2
 
3 3
 class StoreSettingsTest extends FS_Test{
4 4
 
5
-	protected static $use_draft_site = true;
5
+    protected static $use_draft_site = true;
6 6
 
7
-	function setUp(){
8
-		parent::setUp();
7
+    function setUp(){
8
+        parent::setUp();
9 9
 
10
-		$siteConf = SiteConfig::current_site_config();
11
-		$siteConf->StoreName = 'foxystripe';
10
+        $siteConf = SiteConfig::current_site_config();
11
+        $siteConf->StoreName = 'foxystripe';
12 12
         $siteConf->requireDefaultRecords();
13
-		$siteConf->write();
14
-	}
13
+        $siteConf->write();
14
+    }
15 15
 
16
-	function testStoreKey(){
17
-		$pref = FoxyCart::getKeyPrefix();
18
-		$siteConf = SiteConfig::current_site_config();
16
+    function testStoreKey(){
17
+        $pref = FoxyCart::getKeyPrefix();
18
+        $siteConf = SiteConfig::current_site_config();
19 19
 
20
-		$this->assertTrue(ctype_alnum($siteConf->StoreKey));
20
+        $this->assertTrue(ctype_alnum($siteConf->StoreKey));
21 21
         $this->assertEquals(strlen($siteConf->StoreKey), 60);
22 22
         $this->assertEquals(substr($siteConf->StoreKey, 0, 6), $pref);
23
-	}
23
+    }
24 24
 
25
-	function testStoreName(){
26
-		$siteConf = SiteConfig::current_site_config();
25
+    function testStoreName(){
26
+        $siteConf = SiteConfig::current_site_config();
27 27
 
28 28
         $this->assertEquals($siteConf->StoreName, 'foxystripe');
29
-	}
29
+    }
30 30
 
31 31
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class StoreSettingsTest extends FS_Test{
3
+class StoreSettingsTest 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
 		$siteConf = SiteConfig::current_site_config();
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 		$siteConf->write();
14 14
 	}
15 15
 
16
-	function testStoreKey(){
16
+	function testStoreKey() {
17 17
 		$pref = FoxyCart::getKeyPrefix();
18 18
 		$siteConf = SiteConfig::current_site_config();
19 19
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $this->assertEquals(substr($siteConf->StoreKey, 0, 6), $pref);
23 23
 	}
24 24
 
25
-	function testStoreName(){
25
+	function testStoreName() {
26 26
 		$siteConf = SiteConfig::current_site_config();
27 27
 
28 28
         $this->assertEquals($siteConf->StoreName, 'foxystripe');
Please login to merge, or discard this patch.
tests/ProductPageTest.php 3 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,14 +41,18 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -2,247 +2,247 @@
 block discarded – undo
2 2
 
3 3
 class ProductPageTest extends FS_Test{
4 4
 
5
-	protected static $use_draft_site = true;
5
+    protected static $use_draft_site = true;
6 6
 
7
-	function setUp(){
8
-		parent::setUp();
7
+    function setUp(){
8
+        parent::setUp();
9 9
 
10
-		$groupForItem = OptionGroup::create();
11
-		$groupForItem->Title = 'Sample-Group';
12
-		$groupForItem->write();
10
+        $groupForItem = OptionGroup::create();
11
+        $groupForItem->Title = 'Sample-Group';
12
+        $groupForItem->write();
13 13
 
14
-		/*$productHolder = ProductHolder::create();
14
+        /*$productHolder = ProductHolder::create();
15 15
 		$productHolder->Title = 'Product Holder';
16 16
 		$productHolder->write();*/
17
-	}
17
+    }
18 18
 
19
-	function testProductCreation(){
19
+    function testProductCreation(){
20 20
 
21
-		$this->logInWithPermission('Product_CANCRUD');
22
-		$default = $this->objFromFixture('ProductCategory', 'default');
23
-		$default->write();
24
-		$holder = $this->objFromFixture('ProductHolder', 'holder');
25
-		$holder->doPublish();
26
-		$product1 = $this->objFromFixture('ProductPage', 'product1');
27
-		//$product1->ParentID = ProductHolder::get()->first()->ID;
21
+        $this->logInWithPermission('Product_CANCRUD');
22
+        $default = $this->objFromFixture('ProductCategory', 'default');
23
+        $default->write();
24
+        $holder = $this->objFromFixture('ProductHolder', 'holder');
25
+        $holder->doPublish();
26
+        $product1 = $this->objFromFixture('ProductPage', 'product1');
27
+        //$product1->ParentID = ProductHolder::get()->first()->ID;
28 28
 
29
-		$product1->doPublish();
30
-		$this->assertTrue($product1->isPublished());
29
+        $product1->doPublish();
30
+        $this->assertTrue($product1->isPublished());
31 31
 
32
-	}
32
+    }
33 33
 
34
-	function testProductDeletion(){
34
+    function testProductDeletion(){
35 35
 
36
-		$this->logInWithPermission('Product_CANCRUD');
37
-		$holder = $this->objFromFixture('ProductHolder', 'holder');
38
-		$holder->doPublish();
39
-		$product2 = $this->objFromFixture('ProductPage', 'product2');
40
-		$productID = $product2->ID;
36
+        $this->logInWithPermission('Product_CANCRUD');
37
+        $holder = $this->objFromFixture('ProductHolder', 'holder');
38
+        $holder->doPublish();
39
+        $product2 = $this->objFromFixture('ProductPage', 'product2');
40
+        $productID = $product2->ID;
41 41
 
42
-		$product2->doPublish();
43
-		$this->assertTrue($product2->isPublished());
42
+        $product2->doPublish();
43
+        $this->assertTrue($product2->isPublished());
44 44
 
45
-		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
46
-		$versionsPostPublish = array();
47
-		foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow;
45
+        $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
46
+        $versionsPostPublish = array();
47
+        foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow;
48 48
 
49
-		$product2->delete();
50
-		$this->assertTrue(!$product2->isPublished());
49
+        $product2->delete();
50
+        $this->assertTrue(!$product2->isPublished());
51 51
 
52
-		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
53
-		$versionsPostDelete = array();
54
-		foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow;
52
+        $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
53
+        $versionsPostDelete = array();
54
+        foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow;
55 55
 
56
-		$this->assertTrue($versionsPostPublish == $versionsPostDelete);
56
+        $this->assertTrue($versionsPostPublish == $versionsPostDelete);
57 57
 
58
-	}
58
+    }
59 59
 
60
-	function testProductTitleLeadingWhiteSpace(){
60
+    function testProductTitleLeadingWhiteSpace(){
61 61
 
62
-		$this->logInWithPermission('ADMIN');
62
+        $this->logInWithPermission('ADMIN');
63 63
 
64
-		$holder = $this->objFromFixture('ProductHolder', 'holder');
65
-		$holder->doPublish();
64
+        $holder = $this->objFromFixture('ProductHolder', 'holder');
65
+        $holder->doPublish();
66 66
 
67
-		$product = $this->objFromFixture('ProductPage', 'product1');
68
-		$product->Title = " Test with leading space";
69
-		$product->doPublish();
67
+        $product = $this->objFromFixture('ProductPage', 'product1');
68
+        $product->Title = " Test with leading space";
69
+        $product->doPublish();
70 70
 
71
-		$this->assertTrue($product->Title == 'Test with leading space');
71
+        $this->assertTrue($product->Title == 'Test with leading space');
72 72
 
73
-	}
73
+    }
74 74
 
75
-	function testProductTitleTrailingWhiteSpace(){
75
+    function testProductTitleTrailingWhiteSpace(){
76 76
 
77
-		$this->logInWithPermission('ADMIN');
77
+        $this->logInWithPermission('ADMIN');
78 78
 
79
-		$holder = $this->objFromFixture('ProductHolder', 'holder');
80
-		$holder->doPublish();
79
+        $holder = $this->objFromFixture('ProductHolder', 'holder');
80
+        $holder->doPublish();
81 81
 
82
-		$product = $this->objFromFixture('ProductPage', 'product1');
83
-		$product->Title = "Test with trailing space ";
84
-		$product->doPublish();
82
+        $product = $this->objFromFixture('ProductPage', 'product1');
83
+        $product->Title = "Test with trailing space ";
84
+        $product->doPublish();
85 85
 
86
-		$this->assertTrue($product->Title == 'Test with trailing space');
86
+        $this->assertTrue($product->Title == 'Test with trailing space');
87 87
 
88
-	}
88
+    }
89 89
 
90
-	function testProductCategoryCreation(){
90
+    function testProductCategoryCreation(){
91 91
 
92
-		$this->logInWithPermission('Product_CANCRUD');
93
-		$category = $this->objFromFixture('ProductCategory', 'apparel');
94
-		$category->write();
95
-		$categoryID = $category->ID;
92
+        $this->logInWithPermission('Product_CANCRUD');
93
+        $category = $this->objFromFixture('ProductCategory', 'apparel');
94
+        $category->write();
95
+        $categoryID = $category->ID;
96 96
 
97
-		$productCategory = ProductCategory::get()->filter(array('Code'=>'APPAREL'))->first();
97
+        $productCategory = ProductCategory::get()->filter(array('Code'=>'APPAREL'))->first();
98 98
 
99
-		$this->assertTrue($categoryID == $productCategory->ID);
99
+        $this->assertTrue($categoryID == $productCategory->ID);
100 100
 
101
-	}
101
+    }
102 102
 
103
-	function testProductCategoryDeletion(){
103
+    function testProductCategoryDeletion(){
104 104
 
105
-		$this->logInWithPermission('Product_CANCRUD');
105
+        $this->logInWithPermission('Product_CANCRUD');
106 106
 
107
-		$category = $this->objFromFixture('ProductCategory', 'default');
108
-		$category->write();
107
+        $category = $this->objFromFixture('ProductCategory', 'default');
108
+        $category->write();
109 109
 
110
-		$this->assertFalse($category->canDelete());
110
+        $this->assertFalse($category->canDelete());
111 111
 
112
-		$category2 = $this->objFromFixture('ProductCategory', 'apparel');
113
-		$category2->write();
114
-		$category2ID = $category2->ID;
112
+        $category2 = $this->objFromFixture('ProductCategory', 'apparel');
113
+        $category2->write();
114
+        $category2ID = $category2->ID;
115 115
 
116
-		$this->assertTrue($category2->canDelete());
116
+        $this->assertTrue($category2->canDelete());
117 117
 
118
-		$this->logOut();
118
+        $this->logOut();
119 119
 
120
-		$this->logInWithPermission('ADMIN');
120
+        $this->logInWithPermission('ADMIN');
121 121
 
122
-		$this->assertFalse($category->canDelete());
123
-		$this->assertTrue($category2->canDelete());
122
+        $this->assertFalse($category->canDelete());
123
+        $this->assertTrue($category2->canDelete());
124 124
 
125
-		$this->logOut();
126
-		$this->logInWithPermission('Product_CANCRUD');
125
+        $this->logOut();
126
+        $this->logInWithPermission('Product_CANCRUD');
127 127
 
128
-		$category2->delete();
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
-		$this->logInWithPermission('Product_CANCRUD');
136
+        $this->logInWithPermission('Product_CANCRUD');
137 137
 
138
-		$group = $this->objFromFixture('OptionGroup', 'size');
139
-		$group->write();
138
+        $group = $this->objFromFixture('OptionGroup', 'size');
139
+        $group->write();
140 140
 
141
-		$this->assertNotNull(OptionGroup::get()->first());
141
+        $this->assertNotNull(OptionGroup::get()->first());
142 142
 
143
-	}
143
+    }
144 144
 
145
-	function testOptionGroupDeletion(){
145
+    function testOptionGroupDeletion(){
146 146
 
147
-		$this->logInWithPermission('ADMIN');
148
-		$group = $this->objFromFixture('OptionGroup', 'color');
149
-		$group->write();
150
-		$groupID = $group->ID;
147
+        $this->logInWithPermission('ADMIN');
148
+        $group = $this->objFromFixture('OptionGroup', 'color');
149
+        $group->write();
150
+        $groupID = $group->ID;
151 151
 
152
-		$this->assertTrue($group->canDelete());
152
+        $this->assertTrue($group->canDelete());
153 153
 
154
-		$this->logOut();
155
-		$this->logInWithPermission('Product_CANCRUD');
154
+        $this->logOut();
155
+        $this->logInWithPermission('Product_CANCRUD');
156 156
 
157
-		$this->assertTrue($group->canDelete());
158
-		$group->delete();
157
+        $this->assertTrue($group->canDelete());
158
+        $group->delete();
159 159
 
160
-		$this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID')));
160
+        $this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID')));
161 161
 
162
-	}
162
+    }
163 163
 
164
-	function testOptionItemCreation(){
164
+    function testOptionItemCreation(){
165 165
 
166
-		$this->logInWithPermission('Product_CANCRUD');
166
+        $this->logInWithPermission('Product_CANCRUD');
167 167
 
168
-		$optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first();
168
+        $optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first();
169 169
 
170
-		$option = $this->objFromFixture('OptionItem', 'large');
171
-		$option->ProductOptionGroupID = $optionGroup->ID;
172
-		$option->write();
170
+        $option = $this->objFromFixture('OptionItem', 'large');
171
+        $option->ProductOptionGroupID = $optionGroup->ID;
172
+        $option->write();
173 173
 
174
-		$optionID = $option->ID;
174
+        $optionID = $option->ID;
175 175
 
176
-		$optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first();
176
+        $optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first();
177 177
 
178
-		$this->assertEquals($optionID, $optionItem->ID);
178
+        $this->assertEquals($optionID, $optionItem->ID);
179 179
 
180
-	}
180
+    }
181 181
 
182
-	function testOptionItemDeletion(){
182
+    function testOptionItemDeletion(){
183 183
 
184
-		$this->logInWithPermission('ADMIN');
184
+        $this->logInWithPermission('ADMIN');
185 185
 
186
-		$optionGroup = $this->objFromFixture('OptionGroup', 'size');
187
-		$optionGroup->write();
186
+        $optionGroup = $this->objFromFixture('OptionGroup', 'size');
187
+        $optionGroup->write();
188 188
 
189
-		$option = $this->objFromFixture('OptionItem', 'small');
190
-		$option->write();
189
+        $option = $this->objFromFixture('OptionItem', 'small');
190
+        $option->write();
191 191
 
192
-		$optionID = $option->ID;
192
+        $optionID = $option->ID;
193 193
 
194
-		$this->assertTrue($option->canDelete());
194
+        $this->assertTrue($option->canDelete());
195 195
 
196
-		$this->logOut();
197
-		$this->logInWithPermission('Product_CANCRUD');
196
+        $this->logOut();
197
+        $this->logInWithPermission('Product_CANCRUD');
198 198
 
199
-		$this->assertTrue($option->canDelete());
200
-		$option->delete();
199
+        $this->assertTrue($option->canDelete());
200
+        $option->delete();
201 201
 
202
-		$this->assertFalse(in_array($optionID, OptionItem::get()->column('ID')));
202
+        $this->assertFalse(in_array($optionID, OptionItem::get()->column('ID')));
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
-		$this->logInWithPermission('ADMIN');
210
+        $this->logInWithPermission('ADMIN');
211 211
 
212
-		$holder = $this->objFromFixture('ProductHolder', 'holder');//build holder page, ProductPage can't be on root level
213
-		$holder->doPublish();
212
+        $holder = $this->objFromFixture('ProductHolder', 'holder');//build holder page, ProductPage can't be on root level
213
+        $holder->doPublish();
214 214
 
215
-		$product = $this->objFromFixture('ProductPage', 'product1');//build product page
216
-		$product->doPublish();
215
+        $product = $this->objFromFixture('ProductPage', 'product1');//build product page
216
+        $product->doPublish();
217 217
 
218
-		$productID = $product->ID;
218
+        $productID = $product->ID;
219 219
 
220 220
 
221
-		$optionGroup = $this->objFromFixture('OptionGroup', 'size');//build the group for the options
222
-		$optionGroup->write();
223
-		$option = $this->objFromFixture('OptionItem', 'small');//build first option
224
-		$option->write();
225
-		$option2 = $this->objFromFixture('OptionItem', 'large');//build second option
226
-		$option2->write();
221
+        $optionGroup = $this->objFromFixture('OptionGroup', 'size');//build the group for the options
222
+        $optionGroup->write();
223
+        $option = $this->objFromFixture('OptionItem', 'small');//build first option
224
+        $option->write();
225
+        $option2 = $this->objFromFixture('OptionItem', 'large');//build second option
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
-		$testOption = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first();
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
 
248 248
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
code/pages/ProductHolder.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
      * Products function.
124 124
      * 
125 125
      * @access public
126
-     * @return array
126
+     * @return PaginatedList
127 127
      */
128 128
     public function ProductList($limit = 10)
129 129
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
     {
130 130
         $config = SiteConfig::current_site_config();
131 131
 
132
-        if ($config->ProductLimit>0) {
132
+        if ($config->ProductLimit > 0) {
133 133
             $limit = $config->ProductLimit;
134 134
         }
135 135
 
136 136
         if ($config->MultiGroup) {
137 137
             $entries = $this->Products()->sort('SortOrder');
138
-        } else {
139
-            $filter = '"ParentID" = ' . $this->ID;
138
+        }else {
139
+            $filter = '"ParentID" = '.$this->ID;
140 140
 
141 141
             // Build a list of all IDs for ProductGroups that are children
142 142
             $holderIDs = $this->ProductGroupIDs();
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                 if ($filter) {
148 148
                     $filter .= ' OR ';
149 149
                 }
150
-                $filter .= '"ParentID" IN (' . implode(',', $holderIDs) . ")";
150
+                $filter .= '"ParentID" IN ('.implode(',', $holderIDs).")";
151 151
             }
152 152
 
153 153
             $order = '"SiteTree"."Title" ASC';
Please login to merge, or discard this patch.
code/objects/Order.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,8 +85,8 @@
 block discarded – undo
85 85
 
86 86
     public function getReceiptLink()
87 87
     {
88
-        $obj= HTMLVarchar::create();
89
-        $obj->setValue('<a href="' . $this->ReceiptURL . '" target="_blank" class="cms-panel-link action external-link">view</a>');
88
+        $obj = HTMLVarchar::create();
89
+        $obj->setValue('<a href="'.$this->ReceiptURL.'" target="_blank" class="cms-panel-link action external-link">view</a>');
90 90
         return $obj;
91 91
     }
92 92
 
Please login to merge, or discard this patch.
tests/OptionGroupTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@
 block discarded – undo
23 23
     {
24 24
         $object = $this->objFromFixture('OptionGroup', 'size');
25 25
         $orig = $object->Title;
26
-        $object->Title = '2' . $orig;
26
+        $object->Title = '2'.$orig;
27 27
         $this->setExpectedException('ValidationException');
28 28
         $object->write();
29 29
 
30
-        $object->Title = $orig . '&';
30
+        $object->Title = $orig.'&';
31 31
         $this->setExpectedException('ValidationException');
32 32
         $object->write();
33 33
     }
Please login to merge, or discard this patch.
code/objects/OptionItem.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -285,7 +285,7 @@
 block discarded – undo
285 285
     }
286 286
 
287 287
     /**
288
-     * @return mixed|string
288
+     * @return string
289 289
      */
290 290
     public function getGeneratedTitle()
291 291
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $parentCode = $product->Code;
91 91
 
92 92
         // ProductOptionGroup Dropdown field w/ add new
93
-        $groups = function () {
93
+        $groups = function() {
94 94
             return OptionGroup::get()->map()->toArray();
95 95
         };
96 96
         $groupFields = singleton('OptionGroup')->getCMSFields();
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      * @param bool $returnWithOnlyPlusMinus
225 225
      * @return string
226 226
      */
227
-    public static function getOptionModifierActionSymbol($oma, $returnWithOnlyPlusMinus=false)
227
+    public static function getOptionModifierActionSymbol($oma, $returnWithOnlyPlusMinus = false)
228 228
     {
229 229
         switch ($oma) {
230 230
             case 'Subtract':
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
     {
292 292
         $modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0';
293 293
         $title = $this->Title;
294
-        $title .= ($this->PriceModifier != 0) ? ': ('.OptionItem::getOptionModifierActionSymbol($this->PriceModifierAction, $returnWithOnlyPlusMinus=true).'$'.$modPrice.')' : '';
294
+        $title .= ($this->PriceModifier != 0) ? ': ('.OptionItem::getOptionModifierActionSymbol($this->PriceModifierAction, $returnWithOnlyPlusMinus = true).'$'.$modPrice.')' : '';
295 295
         return $title;
296 296
     }
297 297
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      */
301 301
     public function getAvailability()
302 302
     {
303
-        $available = ($this->Available == 1) ? true : false ;
303
+        $available = ($this->Available == 1) ? true : false;
304 304
 
305 305
         $this->extend('updateOptionAvailability', $available);
306 306
 
Please login to merge, or discard this patch.
code/pages/ProductPage.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             'Image used throughout site to represent this product');
96 96
 
97 97
         // Cateogry Dropdown field w/ add new
98
-        $source = function () {
98
+        $source = function() {
99 99
             return ProductCategory::get()->map()->toArray();
100 100
         };
101 101
         $catField = DropdownField::create('CategoryID', _t('ProductPage.Category', 'FoxyCart Category'), $source())
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         if (class_exists('GridFieldSortableRows')) {
140 140
             $config->addComponent(new GridFieldSortableRows('SortOrder'));
141 141
             $products = $this->ProductOptions()->sort('SortOrder');
142
-        } else {
142
+        }else {
143 143
             $products = $this->ProductOptions();
144 144
         }
145 145
         $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                 ->setFolderName('Uploads/Products')
196 196
                 ->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'))
197 197
                 ->setAllowedMaxFileNumber(1),
198
-            HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD' . 'Product Image Gallery'), 2),
198
+            HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD'.'Product Image Gallery'), 2),
199 199
             $prodImagesField
200 200
                 ->setDescription(_t(
201 201
                     'ProductPage.ProductImagesDescription',
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             $product = ProductPage::get()->byID($this->ID);
242 242
             if (isset($product->ParentID)) {
243 243
                 $origParent = $product->ParentID;
244
-            } else {
244
+            }else {
245 245
                 $origParent = null;
246 246
             }
247 247
             $currentParent = $this->ParentID;
@@ -322,14 +322,13 @@  discard block
 block discarded – undo
322 322
     ) {
323 323
         $optionName = ($optionName !== null) ? preg_replace('/\s/', '_', $optionName) : $optionName;
324 324
         return (SiteConfig::current_site_config()->CartValidation)
325
-            ? FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) :
326
-            $optionValue;
325
+            ? FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : $optionValue;
327 326
     }
328 327
 
329 328
     // get FoxyCart Store Name for JS call
330 329
     public function getCartScript()
331 330
     {
332
-        return '<script src="https://cdn.foxycart.com/' . FoxyCart::getFoxyCartStoreName() . '/loader.js" async defer></script>';
331
+        return '<script src="https://cdn.foxycart.com/'.FoxyCart::getFoxyCartStoreName().'/loader.js" async defer></script>';
333 332
     }
334 333
 
335 334
     /**
Please login to merge, or discard this patch.