Completed
Push — master ( a10f05...2ab214 )
by Jason
9s
created
code/extensions/FoxyStripeSiteConfig.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class FoxyStripeSiteConfig extends DataExtension{
3
+class FoxyStripeSiteConfig extends DataExtension {
4 4
 
5 5
 	private static $db = array(
6 6
 		'StoreName' => 'Varchar(255)',
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         'ProductLimit' => 10
17 17
     );
18 18
 
19
-	public function updateCMSFields(FieldList $fields){
19
+	public function updateCMSFields(FieldList $fields) {
20 20
 
21 21
         // set TabSet names to avoid spaces from camel case
22 22
         $fields->addFieldToTab('Root', new TabSet('FoxyStripe', 'FoxyStripe'));
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         ));
56 56
 
57 57
         // configuration warning
58
-		if(FoxyCart::store_name_warning()!==null){
58
+		if (FoxyCart::store_name_warning() !== null) {
59 59
 			$fields->insertBefore(LiteralField::create(
60 60
                 "StoreSubDomainHeaderWarning",
61 61
                 _t(
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 
138 138
         $siteConfig = SiteConfig::current_site_config();
139 139
 
140
-        if(!$siteConfig->StoreKey) {
140
+        if (!$siteConfig->StoreKey) {
141 141
             $key = FoxyCart::setStoreKey();
142
-            while(!ctype_alnum($key)){
142
+            while (!ctype_alnum($key)) {
143 143
                 $key = FoxyCart::setStoreKey();
144 144
             }
145 145
             $siteConfig->StoreKey = $key;
146 146
             $siteConfig->write();
147
-            DB::alteration_message($siteConfig->ClassName.": created FoxyCart Store Key " . $key, 'created');
147
+            DB::alteration_message($siteConfig->ClassName.": created FoxyCart Store Key ".$key, 'created');
148 148
         }
149 149
     }
150 150
 
Please login to merge, or discard this patch.
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -2,21 +2,21 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FoxyStripeSiteConfig extends DataExtension{
4 4
 
5
-	private static $db = array(
6
-		'StoreName' => 'Varchar(255)',
7
-		'StoreKey' => 'Varchar(60)',
8
-		'MultiGroup' => 'Boolean',
9
-		'ProductLimit' => 'Int',
10
-		'CartValidation' => 'Boolean',
11
-		'MaxQuantity' => 'Int'
12
-	);
5
+    private static $db = array(
6
+        'StoreName' => 'Varchar(255)',
7
+        'StoreKey' => 'Varchar(60)',
8
+        'MultiGroup' => 'Boolean',
9
+        'ProductLimit' => 'Int',
10
+        'CartValidation' => 'Boolean',
11
+        'MaxQuantity' => 'Int'
12
+    );
13 13
 
14 14
     // Set Default values
15 15
     private static $defaults = array(
16 16
         'ProductLimit' => 10
17 17
     );
18 18
 
19
-	public function updateCMSFields(FieldList $fields){
19
+    public function updateCMSFields(FieldList $fields){
20 20
 
21 21
         // set TabSet names to avoid spaces from camel case
22 22
         $fields->addFieldToTab('Root', new TabSet('FoxyStripe', 'FoxyStripe'));
@@ -24,103 +24,103 @@  discard block
 block discarded – undo
24 24
         // settings tab
25 25
         $fields->addFieldsToTab('Root.FoxyStripe.Settings', array(
26 26
             // Store Details
27
-			HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3),
28
-			LiteralField::create('DetailsIntro', _t(
29
-				'FoxyStripeSiteConfig.DetailsIntro',
27
+            HeaderField::create('StoreDetails', _t('FoxyStripeSiteConfig.StoreDetails', 'Store Settings'), 3),
28
+            LiteralField::create('DetailsIntro', _t(
29
+                'FoxyStripeSiteConfig.DetailsIntro',
30 30
                 '<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditStore" target="_blank">FoxyCart store settings</a>.'
31 31
             )),
32
-			TextField::create('StoreName')
33
-				->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Sub Domain'))
34
-				->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'the sub domain for your FoxyCart store')),
32
+            TextField::create('StoreName')
33
+                ->setTitle(_t('FoxyStripeSiteConfig.StoreName', 'Store Sub Domain'))
34
+                ->setDescription(_t('FoxyStripeSiteConfig.StoreNameDescription', 'the sub domain for your FoxyCart store')),
35 35
 
36
-			// Advanced Settings
37
-			HeaderField::create('AdvanceHeader', _t('FoxyStripeSiteConfig.AdvancedHeader', 'Advanced Settings'), 3),
38
-			LiteralField::create('AdvancedIntro', _t(
36
+            // Advanced Settings
37
+            HeaderField::create('AdvanceHeader', _t('FoxyStripeSiteConfig.AdvancedHeader', 'Advanced Settings'), 3),
38
+            LiteralField::create('AdvancedIntro', _t(
39 39
                 'FoxyStripeSiteConfig.AdvancedIntro',
40
-				'<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures" target="_blank">FoxyCart advanced store settings</a>.</p>'
41
-			)),
42
-			ReadonlyField::create('DataFeedLink', _t('FoxyStripeSiteConfig.DataFeedLink', 'FoxyCart DataFeed URL'), self::getDataFeedLink())
43
-				->setDescription(_t('FoxyStripeSiteConfig.DataFeedLinkDescription', 'copy/paste to FoxyCart')),
44
-			CheckboxField::create('CartValidation')
45
-				->setTitle(_t('FoxyStripeSiteConfig.CartValidation', 'Enable Cart Validation'))
46
-				->setDescription(_t(
40
+                '<p>Maps to data in your <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures" target="_blank">FoxyCart advanced store settings</a>.</p>'
41
+            )),
42
+            ReadonlyField::create('DataFeedLink', _t('FoxyStripeSiteConfig.DataFeedLink', 'FoxyCart DataFeed URL'), self::getDataFeedLink())
43
+                ->setDescription(_t('FoxyStripeSiteConfig.DataFeedLinkDescription', 'copy/paste to FoxyCart')),
44
+            CheckboxField::create('CartValidation')
45
+                ->setTitle(_t('FoxyStripeSiteConfig.CartValidation', 'Enable Cart Validation'))
46
+                ->setDescription(_t(
47 47
                     'FoxyStripeSiteConfig.CartValidationDescription',
48 48
                     'You must <a href="https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures#use_cart_validation" target="_blank">enable cart validation</a> in the FoxyCart admin.'
49 49
             )),
50
-			ReadonlyField::create('StoreKey')
51
-				->setTitle(_t('FoxyStripeSiteConfig.StoreKey', 'FoxyCart API Key'))
52
-				->setDescription(_t('FoxyStripeSiteConfig.StoreKeyDescription', 'copy/paste to FoxyCart')),
53
-			ReadonlyField::create('SSOLink', _t('FoxyStripeSiteConfig.SSOLink', 'Single Sign On URL'), self::getSSOLink())
54
-				->setDescription(_t('FoxyStripeSiteConfig.SSOLinkDescription', 'copy/paste to FoxyCart'))
50
+            ReadonlyField::create('StoreKey')
51
+                ->setTitle(_t('FoxyStripeSiteConfig.StoreKey', 'FoxyCart API Key'))
52
+                ->setDescription(_t('FoxyStripeSiteConfig.StoreKeyDescription', 'copy/paste to FoxyCart')),
53
+            ReadonlyField::create('SSOLink', _t('FoxyStripeSiteConfig.SSOLink', 'Single Sign On URL'), self::getSSOLink())
54
+                ->setDescription(_t('FoxyStripeSiteConfig.SSOLinkDescription', 'copy/paste to FoxyCart'))
55 55
         ));
56 56
 
57 57
         // configuration warning
58
-		if(FoxyCart::store_name_warning()!==null){
59
-			$fields->insertBefore(LiteralField::create(
58
+        if(FoxyCart::store_name_warning()!==null){
59
+            $fields->insertBefore(LiteralField::create(
60 60
                 "StoreSubDomainHeaderWarning",
61 61
                 _t(
62 62
                     'FoxyStripeSiteConfig.StoreSubDomainHeadingWarning',
63 63
                     "<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>"
64 64
                 )
65 65
             ), 'StoreDetails');
66
-		}
66
+        }
67 67
 
68 68
         // products tab
69
-		$fields->addFieldsToTab('Root.FoxyStripe.Products', array(
70
-			HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3),
71
-			CheckboxField::create('MultiGroup')
72
-				->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups'))
73
-				->setDescription(_t(
69
+        $fields->addFieldsToTab('Root.FoxyStripe.Products', array(
70
+            HeaderField::create('ProductHeader', _t('FoxyStripeSiteConfig.ProductHeader', 'Products'), 3),
71
+            CheckboxField::create('MultiGroup')
72
+                ->setTitle(_t('FoxyStripeSiteConfig.MultiGroup', 'Multiple Groups'))
73
+                ->setDescription(_t(
74 74
                     'FoxyStripeSiteConfig.MultiGroupDescription',
75 75
                     'Allows products to be shown in multiple Product Groups'
76 76
                 )),
77
-			HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3),
78
-			NumericField::create('ProductLimit')
79
-				->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page'))
80
-				->setDescription(_t(
77
+            HeaderField::create('ProductGroupHD', _t('FoxyStripeSiteConfig.ProductGroupHD', 'Product Groups'), 3),
78
+            NumericField::create('ProductLimit')
79
+                ->setTitle(_t('FoxyStripeSiteConfig.ProductLimit', 'Products per Page'))
80
+                ->setDescription(_t(
81 81
                     'FoxyStripeSiteConfig.ProductLimitDescription',
82 82
                     'Number of Products to show per page on a Product Group'
83 83
                 )),
84
-			HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3),
85
-			NumericField::create('MaxQuantity')
86
-				->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity'))
87
-				->setDescription(_t(
84
+            HeaderField::create('ProductQuantityHD', _t('FoxyStripeSiteConfig.ProductQuantityHD', 'Product Form Max Quantity'), 3),
85
+            NumericField::create('MaxQuantity')
86
+                ->setTitle(_t('FoxyStripeSiteConfig.MaxQuantity', 'Max Quantity'))
87
+                ->setDescription(_t(
88 88
                     'FoxyStripeSiteConfig.MaxQuantityDescription',
89 89
                     'Sets max quantity for product form dropdown (add to cart form - default 10)'
90 90
                 ))
91
-		));
91
+        ));
92 92
 
93 93
         // categories tab
94
-		$fields->addFieldsToTab('Root.FoxyStripe.Categories', array(
95
-			HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3),
96
-			LiteralField::create('CategoryDescrip', _t(
94
+        $fields->addFieldsToTab('Root.FoxyStripe.Categories', array(
95
+            HeaderField::create('CategoryHD', _t('FoxyStripeSiteConfig.CategoryHD', 'FoxyStripe Categories'), 3),
96
+            LiteralField::create('CategoryDescrip', _t(
97 97
                 'FoxyStripeSiteConfig.CategoryDescrip',
98 98
                 '<p>FoxyCart Categories offer a way to give products additional behaviors that cannot be accomplished by product options alone, including category specific coupon codes, shipping and handling fees, and email receipts. <a href="https://wiki.foxycart.com/v/2.0/categories" target="_blank">Learn More</a></p><p>Categories you\'ve created in FoxyStripe must also be created in your <a href="https://admin.foxycart.com/admin.php?ThisAction=ManageProductCategories" target="_blank">FoxyCart Categories</a> admin panel.</p>'
99 99
             )),
100
-			GridField::create(
100
+            GridField::create(
101 101
                 'ProductCategory',
102 102
                 _t('FoxyStripeSiteConfig.ProductCategory', 'FoxyCart Categories'),
103 103
                 ProductCategory::get(),
104 104
                 GridFieldConfig_RecordEditor::create()
105 105
             )
106
-		));
106
+        ));
107 107
 
108 108
         // option groups tab
109
-		$fields->addFieldsToTab('Root.FoxyStripe.Groups', array(
110
-			HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3),
111
-			LiteralField::create('OptionGroupsDescrip', _t(
109
+        $fields->addFieldsToTab('Root.FoxyStripe.Groups', array(
110
+            HeaderField::create('OptionGroupsHead', _t('FoxyStripeSiteConfig', 'Product Option Groups'), 3),
111
+            LiteralField::create('OptionGroupsDescrip', _t(
112 112
                 'FoxyStripeSiteConfig.OptionGroupsDescrip',
113 113
                 '<p>Product Option Groups allow you to name a set of product options.</p>'
114 114
             )),
115
-			GridField::create(
115
+            GridField::create(
116 116
                 'OptionGroup',
117 117
                 _t('FoxyStripeSiteConfig.OptionGroup', 'Product Option Groups'),
118 118
                 OptionGroup::get(),
119 119
                 GridFieldConfig_RecordEditor::create()
120 120
             )
121
-		));
121
+        ));
122 122
 
123
-	}
123
+    }
124 124
 
125 125
     private static function getSSOLink() {
126 126
         return Director::absoluteBaseURL()."foxystripe/sso/";
Please login to merge, or discard this patch.
code/extensions/CustomerExtension.php 2 patches
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',
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
         $response = FoxyCart::putCustomer($this->owner);
28 28
 
29 29
         // Grab customer_id record from FoxyCart response, store in Member
30
-		if($response){
30
+		if ($response) {
31 31
         	$foxyResponse = new SimpleXMLElement($response);
32
-        	$this->owner->Customer_ID = (int) $foxyResponse->customer_id;
32
+        	$this->owner->Customer_ID = (int)$foxyResponse->customer_id;
33 33
 		}
34 34
     }
35 35
 
Please login to merge, or discard this patch.
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.
code/controllers/FoxyStripe_Controller.php 3 patches
Doc Comments   +15 added lines patch added patch discarded remove patch
@@ -34,6 +34,9 @@  discard block
 block discarded – undo
34 34
 		}
35 35
 	}
36 36
 
37
+    /**
38
+     * @param string $encrypted
39
+     */
37 40
     public function handleDataFeed($encrypted, $decrypted){
38 41
         //handle encrypted & decrypted data
39 42
         $orders = new SimpleXMLElement($decrypted);
@@ -79,6 +82,10 @@  discard block
 block discarded – undo
79 82
         }
80 83
     }
81 84
 
85
+    /**
86
+     * @param SimpleXMLElement $orders
87
+     * @param DataObject $transaction
88
+     */
82 89
     public function parseOrderInfo($orders, $transaction) {
83 90
 
84 91
         foreach ($orders->transactions->transaction as $order) {
@@ -95,6 +102,10 @@  discard block
 block discarded – undo
95 102
         }
96 103
     }
97 104
 
105
+    /**
106
+     * @param SimpleXMLElement $orders
107
+     * @param DataObject $transaction
108
+     */
98 109
     public function parseOrderCustomer($orders, $transaction) {
99 110
 
100 111
         foreach ($orders->transactions->transaction as $order) {
@@ -133,6 +144,10 @@  discard block
 block discarded – undo
133 144
         }
134 145
     }
135 146
 
147
+    /**
148
+     * @param SimpleXMLElement $orders
149
+     * @param DataObject $transaction
150
+     */
136 151
     public function parseOrderDetails($orders, $transaction) {
137 152
 
138 153
         // remove previous OrderDetails so we don't end up with duplicates
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,37 +2,37 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FoxyStripe_Controller extends Page_Controller {
4 4
 	
5
-	const URLSegment = 'foxystripe';
5
+    const URLSegment = 'foxystripe';
6 6
 
7
-	public function getURLSegment() {
8
-		return self::URLSegment;
9
-	}
7
+    public function getURLSegment() {
8
+        return self::URLSegment;
9
+    }
10 10
 	
11
-	static $allowed_actions = array(
12
-		'index',
11
+    static $allowed_actions = array(
12
+        'index',
13 13
         'sso'
14
-	);
14
+    );
15 15
 	
16
-	public function index() {
17
-	    // handle POST from FoxyCart API transaction
18
-		if ((isset($_POST["FoxyData"]) OR isset($_POST['FoxySubscriptionData']))) {
19
-			$FoxyData_encrypted = (isset($_POST["FoxyData"])) ?
16
+    public function index() {
17
+        // handle POST from FoxyCart API transaction
18
+        if ((isset($_POST["FoxyData"]) OR isset($_POST['FoxySubscriptionData']))) {
19
+            $FoxyData_encrypted = (isset($_POST["FoxyData"])) ?
20 20
                 urldecode($_POST["FoxyData"]) :
21 21
                 urldecode($_POST["FoxySubscriptionData"]);
22
-			$FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(),$FoxyData_encrypted);
23
-			self::handleDataFeed($FoxyData_encrypted, $FoxyData_decrypted);
22
+            $FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(),$FoxyData_encrypted);
23
+            self::handleDataFeed($FoxyData_encrypted, $FoxyData_decrypted);
24 24
 			
25
-			// extend to allow for additional integrations with Datafeed
26
-			$this->extend('addIntegrations', $FoxyData_encrypted);
25
+            // extend to allow for additional integrations with Datafeed
26
+            $this->extend('addIntegrations', $FoxyData_encrypted);
27 27
 			
28
-			return 'foxy';
28
+            return 'foxy';
29 29
 			
30
-		} else {
30
+        } else {
31 31
 			
32
-			return "No FoxyData or FoxySubscriptionData received.";
32
+            return "No FoxyData or FoxySubscriptionData received.";
33 33
 			
34
-		}
35
-	}
34
+        }
35
+    }
36 36
 
37 37
     public function handleDataFeed($encrypted, $decrypted){
38 38
         //handle encrypted & decrypted data
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
 
204 204
 
205 205
 
206
-	// Single Sign on integration with FoxyCart
206
+    // Single Sign on integration with FoxyCart
207 207
     public function sso() {
208 208
 
209
-	    // GET variables from FoxyCart Request
209
+        // GET variables from FoxyCart Request
210 210
         $fcsid = $this->request->getVar('fcsid');
211 211
         $timestampNew = strtotime('+30 days');
212 212
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $redirect_complete = 'https://' . FoxyCart::getFoxyCartStoreName() . '.foxycart.com/checkout?fc_auth_token=' . $auth_token .
226 226
             '&fcsid=' . $fcsid . '&fc_customer_id=' . $Member->Customer_ID . '&timestamp=' . $timestampNew;
227 227
 	
228
-	    $this->redirect($redirect_complete);
228
+        $this->redirect($redirect_complete);
229 229
 
230 230
     }
231 231
 	
Please login to merge, or discard this patch.
Spacing   +13 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,9 +17,8 @@  discard block
 block discarded – undo
17 17
 	    // handle POST from FoxyCart API transaction
18 18
 		if ((isset($_POST["FoxyData"]) OR isset($_POST['FoxySubscriptionData']))) {
19 19
 			$FoxyData_encrypted = (isset($_POST["FoxyData"])) ?
20
-                urldecode($_POST["FoxyData"]) :
21
-                urldecode($_POST["FoxySubscriptionData"]);
22
-			$FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(),$FoxyData_encrypted);
20
+                urldecode($_POST["FoxyData"]) : urldecode($_POST["FoxySubscriptionData"]);
21
+			$FoxyData_decrypted = rc4crypt::decrypt(FoxyCart::getStoreKey(), $FoxyData_encrypted);
23 22
 			self::handleDataFeed($FoxyData_encrypted, $FoxyData_decrypted);
24 23
 			
25 24
 			// extend to allow for additional integrations with Datafeed
@@ -27,14 +26,14 @@  discard block
 block discarded – undo
27 26
 			
28 27
 			return 'foxy';
29 28
 			
30
-		} else {
29
+		}else {
31 30
 			
32 31
 			return "No FoxyData or FoxySubscriptionData received.";
33 32
 			
34 33
 		}
35 34
 	}
36 35
 
37
-    public function handleDataFeed($encrypted, $decrypted){
36
+    public function handleDataFeed($encrypted, $decrypted) {
38 37
         //handle encrypted & decrypted data
39 38
         $orders = new SimpleXMLElement($decrypted);
40 39
 
@@ -43,12 +42,11 @@  discard block
 block discarded – undo
43 42
 
44 43
             if (isset($order->id)) {
45 44
                 ($transaction = Order::get()->filter('Order_ID', $order->id)->First()) ?
46
-                    $transaction :
47
-                    $transaction = Order::create();
45
+                    $transaction : $transaction = Order::create();
48 46
             }
49 47
 
50 48
             // save base order info
51
-            $transaction->Order_ID = (int) $order->id;
49
+            $transaction->Order_ID = (int)$order->id;
52 50
             $transaction->Response = $decrypted;
53 51
 
54 52
             // record transaction as order
@@ -103,11 +101,11 @@  discard block
 block discarded – undo
103 101
             if (isset($order->customer_email) && $order->is_anonymous == 0) {
104 102
 
105 103
                 // if Customer is existing member, associate with current order
106
-                if(Member::get()->filter('Email', $order->customer_email)->First()) {
104
+                if (Member::get()->filter('Email', $order->customer_email)->First()) {
107 105
 
108 106
                     $customer = Member::get()->filter('Email', $order->customer_email)->First();
109 107
 
110
-                } else {
108
+                }else {
111 109
 
112 110
                     // set PasswordEncryption to 'none' so imported, encrypted password is not encrypted again
113 111
                     Config::inst()->update('Security', 'password_encryption_algorithm', 'none');
@@ -213,17 +211,17 @@  discard block
 block discarded – undo
213 211
         // get current member if logged in. If not, create a 'fake' user with Customer_ID = 0
214 212
         // fake user will redirect to FC checkout, ask customer to log in
215 213
         // to do: consider a login/registration form here if not logged in
216
-        if($Member = Member::currentUser()) {
214
+        if ($Member = Member::currentUser()) {
217 215
             $Member = Member::currentUser();
218
-        } else {
216
+        }else {
219 217
             $Member = new Member();
220 218
             $Member->Customer_ID = 0;
221 219
         }
222 220
 
223
-        $auth_token = sha1($Member->Customer_ID . '|' . $timestampNew . '|' . FoxyCart::getStoreKey());
221
+        $auth_token = sha1($Member->Customer_ID.'|'.$timestampNew.'|'.FoxyCart::getStoreKey());
224 222
 
225
-        $redirect_complete = 'https://' . FoxyCart::getFoxyCartStoreName() . '.foxycart.com/checkout?fc_auth_token=' . $auth_token .
226
-            '&fcsid=' . $fcsid . '&fc_customer_id=' . $Member->Customer_ID . '&timestamp=' . $timestampNew;
223
+        $redirect_complete = 'https://'.FoxyCart::getFoxyCartStoreName().'.foxycart.com/checkout?fc_auth_token='.$auth_token.
224
+            '&fcsid='.$fcsid.'&fc_customer_id='.$Member->Customer_ID.'&timestamp='.$timestampNew;
227 225
 	
228 226
 	    $this->redirect($redirect_complete);
229 227
 
Please login to merge, or discard this patch.
code/forms/FoxyStripePurchaseForm.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     private $product;
21 21
 
22 22
     /**
23
-     * @param $siteConfig
23
+     * @param SiteConfig|null $siteConfig
24 24
      * @return $this
25 25
      */
26 26
     public function setSiteConfig($siteConfig)
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'product_id',
121 121
                 $this->product->ID))->setValue($this->product->ID));
122 122
             $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'price',
123
-                $this->product->Price))->setValue($this->product->Price));//can't override id
123
+                $this->product->Price))->setValue($this->product->Price)); //can't override id
124 124
             $fields->push(HiddenField::create(ProductPage::getGeneratedValue($code, 'weight',
125 125
                 $this->product->Weight))->setValue($this->product->Weight));
126 126
             if ($this->DiscountTitle && $this->ProductDiscountTiers()->exists()) {
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 
152 152
             $fields->push(DropdownField::create('quantity', 'Quantity', $quantity));
153 153
 
154
-            $fields->push(HeaderField::create('submitPrice', '$' . $this->product->Price, 4));
154
+            $fields->push(HeaderField::create('submitPrice', '$'.$this->product->Price, 4));
155 155
 
156 156
 
157 157
             $this->extend('updatePurchaseFormFields', $fields);
158
-        } else {
158
+        }else {
159 159
             $fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock'), 4);
160 160
         }
161 161
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     protected function getProductOptionSet()
193 193
     {
194 194
 
195
-        $assignAvailable = function ($self) {
195
+        $assignAvailable = function($self) {
196 196
             $this->extend('updateFoxyStripePurchaseForm', $form);
197 197
             $self->Available = ($self->getAvailability()) ? true : false;
198 198
         };
Please login to merge, or discard this patch.
code/admin/OrderAdmin.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@
 block discarded – undo
2 2
 
3 3
 class OrderAdmin extends ModelAdmin {
4 4
 
5
-	public static $managed_models = array(
6
-		'Order'
7
-	);
5
+    public static $managed_models = array(
6
+        'Order'
7
+    );
8 8
 	
9
-	static $url_segment = 'orders';
9
+    static $url_segment = 'orders';
10 10
 	
11
-	static $menu_title = 'Orders';
11
+    static $menu_title = 'Orders';
12 12
 
13 13
     public function getEditForm($id = null, $fields = null) {
14 14
         $form = parent::getEditForm($id, $fields);
Please login to merge, or discard this patch.
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/pages/ProductPage.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             'Image used throughout site to represent this product');
92 92
 
93 93
         // Cateogry Dropdown field w/ add new
94
-        $source = function () {
94
+        $source = function() {
95 95
             return ProductCategory::get()->map()->toArray();
96 96
         };
97 97
         $catField = DropdownField::create('CategoryID', _t('ProductPage.Category', 'FoxyCart Category'), $source())
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         if (class_exists('GridFieldSortableRows')) {
136 136
             $config->addComponent(new GridFieldSortableRows('SortOrder'));
137 137
             $products = $this->ProductOptions()->sort('SortOrder');
138
-        } else {
138
+        }else {
139 139
             $products = $this->ProductOptions();
140 140
         }
141 141
         $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                 ->setFolderName('Uploads/Products')
192 192
                 ->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'))
193 193
                 ->setAllowedMaxFileNumber(1),
194
-            HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD' . 'Product Image Gallery'), 2),
194
+            HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD'.'Product Image Gallery'), 2),
195 195
             $prodImagesField
196 196
                 ->setDescription(_t(
197 197
                     'ProductPage.ProductImagesDescription',
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             $product = ProductPage::get()->byID($this->ID);
253 253
             if (isset($product->ParentID)) {
254 254
                 $origParent = $product->ParentID;
255
-            } else {
255
+            }else {
256 256
                 $origParent = null;
257 257
             }
258 258
             $currentParent = $this->ParentID;
@@ -333,14 +333,13 @@  discard block
 block discarded – undo
333 333
     ) {
334 334
         $optionName = ($optionName !== null) ? preg_replace('/\s/', '_', $optionName) : $optionName;
335 335
         return (SiteConfig::current_site_config()->CartValidation)
336
-            ? FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) :
337
-            $optionValue;
336
+            ? FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : $optionValue;
338 337
     }
339 338
 
340 339
     // get FoxyCart Store Name for JS call
341 340
     public function getCartScript()
342 341
     {
343
-        return '<script src="https://cdn.foxycart.com/' . FoxyCart::getFoxyCartStoreName() . '/loader.js" async defer></script>';
342
+        return '<script src="https://cdn.foxycart.com/'.FoxyCart::getFoxyCartStoreName().'/loader.js" async defer></script>';
344 343
     }
345 344
 
346 345
     public function getDiscountFieldValue()
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
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -2,194 +2,194 @@
 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();
15
-		$productHolder->Title = 'Product Holder';
16
-		$productHolder->write();
17
-	}
14
+        $productHolder = ProductHolder::create();
15
+        $productHolder->Title = 'Product Holder';
16
+        $productHolder->write();
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
-		$product1 = $this->objFromFixture('ProductPage', 'product1');
25
-		$product1->ParentID = ProductHolder::get()->first()->ID;
21
+        $this->logInWithPermission('Product_CANCRUD');
22
+        $default = $this->objFromFixture('ProductCategory', 'default');
23
+        $default->write();
24
+        $product1 = $this->objFromFixture('ProductPage', 'product1');
25
+        $product1->ParentID = ProductHolder::get()->first()->ID;
26 26
 
27
-		$product1->doPublish();
28
-		$this->assertTrue($product1->isPublished());
27
+        $product1->doPublish();
28
+        $this->assertTrue($product1->isPublished());
29 29
 
30
-	}
30
+    }
31 31
 
32
-	function testProductDeletion(){
32
+    function testProductDeletion(){
33 33
 
34
-		$this->logInWithPermission('Product_CANCRUD');
35
-		$product2 = $this->objFromFixture('ProductPage', 'product2');
36
-		$product2->ParentID = ProductHolder::get()->first()->ID;
37
-		$productID = $product2->ID;
34
+        $this->logInWithPermission('Product_CANCRUD');
35
+        $product2 = $this->objFromFixture('ProductPage', 'product2');
36
+        $product2->ParentID = ProductHolder::get()->first()->ID;
37
+        $productID = $product2->ID;
38 38
 
39
-		$product2->doPublish();
40
-		$this->assertTrue($product2->isPublished());
39
+        $product2->doPublish();
40
+        $this->assertTrue($product2->isPublished());
41 41
 
42
-		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
43
-		$versionsPostPublish = array();
44
-		foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow;
42
+        $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
43
+        $versionsPostPublish = array();
44
+        foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow;
45 45
 
46
-		$product2->delete();
47
-		$this->assertTrue(!$product2->isPublished());
46
+        $product2->delete();
47
+        $this->assertTrue(!$product2->isPublished());
48 48
 
49
-		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
50
-		$versionsPostDelete = array();
51
-		foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow;
49
+        $versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
50
+        $versionsPostDelete = array();
51
+        foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow;
52 52
 
53
-		$this->assertTrue($versionsPostPublish == $versionsPostDelete);
53
+        $this->assertTrue($versionsPostPublish == $versionsPostDelete);
54 54
 
55
-	}
55
+    }
56 56
 
57
-	function testProductTitleLeadingWhiteSpace(){
57
+    function testProductTitleLeadingWhiteSpace(){
58 58
 
59
-		$this->logInWithPermission('ADMIN');
60
-		$product = $this->objFromFixture('ProductPage', 'product1');
61
-		$product->Title = " Test with leading space";
62
-		$product->ParentID = ProductHolder::get()->first()->ID;
63
-		$product->doPublish();
59
+        $this->logInWithPermission('ADMIN');
60
+        $product = $this->objFromFixture('ProductPage', 'product1');
61
+        $product->Title = " Test with leading space";
62
+        $product->ParentID = ProductHolder::get()->first()->ID;
63
+        $product->doPublish();
64 64
 
65
-		$this->assertTrue($product->Title == 'Test with leading space');
65
+        $this->assertTrue($product->Title == 'Test with leading space');
66 66
 
67
-	}
67
+    }
68 68
 
69
-	function testProductTitleTrailingWhiteSpace(){
69
+    function testProductTitleTrailingWhiteSpace(){
70 70
 
71
-		$this->logInWithPermission('ADMIN');
72
-		$product = $this->objFromFixture('ProductPage', 'product1');
73
-		$product->Title = "Test with trailing space ";
74
-		$product->ParentID = ProductHolder::get()->first()->ID;
75
-		$product->doPublish();
71
+        $this->logInWithPermission('ADMIN');
72
+        $product = $this->objFromFixture('ProductPage', 'product1');
73
+        $product->Title = "Test with trailing space ";
74
+        $product->ParentID = ProductHolder::get()->first()->ID;
75
+        $product->doPublish();
76 76
 
77
-		$this->assertTrue($product->Title == 'Test with trailing space');
77
+        $this->assertTrue($product->Title == 'Test with trailing space');
78 78
 
79
-	}
79
+    }
80 80
 
81
-	function testProductCategoryCreation(){
81
+    function testProductCategoryCreation(){
82 82
 
83
-		$this->logInWithPermission('Product_CANCRUD');
84
-		$category = $this->objFromFixture('ProductCategory', 'apparel');
85
-		$category->write();
86
-		$categoryID = $category->ID;
83
+        $this->logInWithPermission('Product_CANCRUD');
84
+        $category = $this->objFromFixture('ProductCategory', 'apparel');
85
+        $category->write();
86
+        $categoryID = $category->ID;
87 87
 
88
-		$productCategory = ProductCategory::get()->filter(array('Code'=>'APPAREL'))->first();
88
+        $productCategory = ProductCategory::get()->filter(array('Code'=>'APPAREL'))->first();
89 89
 
90
-		$this->assertTrue($categoryID == $productCategory->ID);
90
+        $this->assertTrue($categoryID == $productCategory->ID);
91 91
 
92
-	}
92
+    }
93 93
 
94
-	function testProductCategoryDeletion(){
94
+    function testProductCategoryDeletion(){
95 95
 
96
-		$this->logInWithPermission('Product_CANCRUD');
97
-		$category = $this->objFromFixture('ProductCategory', 'default');
98
-		$category->write();
96
+        $this->logInWithPermission('Product_CANCRUD');
97
+        $category = $this->objFromFixture('ProductCategory', 'default');
98
+        $category->write();
99 99
 
100
-		$this->assertFalse($category->canDelete());
100
+        $this->assertFalse($category->canDelete());
101 101
 
102
-		$category2 = $this->objFromFixture('ProductCategory', 'apparel');
103
-		$category2->write();
104
-		$category2ID = $category2->ID;
102
+        $category2 = $this->objFromFixture('ProductCategory', 'apparel');
103
+        $category2->write();
104
+        $category2ID = $category2->ID;
105 105
 
106
-		$this->assertTrue($category2->canDelete());
106
+        $this->assertTrue($category2->canDelete());
107 107
 
108
-		$this->logOut();
108
+        $this->logOut();
109 109
 
110
-		$this->logInWithPermission('ADMIN');
110
+        $this->logInWithPermission('ADMIN');
111 111
 
112
-		$this->assertFalse($category->canDelete());
113
-		$this->assertTrue($category2->canDelete());
112
+        $this->assertFalse($category->canDelete());
113
+        $this->assertTrue($category2->canDelete());
114 114
 
115
-		$this->logOut();
116
-		$this->logInWithPermission('Product_CANCRUD');
115
+        $this->logOut();
116
+        $this->logInWithPermission('Product_CANCRUD');
117 117
 
118
-		$category2->delete();
118
+        $category2->delete();
119 119
 
120
-		$this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID')));
120
+        $this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID')));
121 121
 
122
-	}
122
+    }
123 123
 
124
-	function testOptionGroupCreation(){
124
+    function testOptionGroupCreation(){
125 125
 
126
-		$this->logInWithPermission('Product_CANCRUD');
127
-		$group = $this->objFromFixture('OptionGroup', 'size');
128
-		$group->write();
126
+        $this->logInWithPermission('Product_CANCRUD');
127
+        $group = $this->objFromFixture('OptionGroup', 'size');
128
+        $group->write();
129 129
 
130
-		$this->assertNotNull(OptionGroup::get()->first());
130
+        $this->assertNotNull(OptionGroup::get()->first());
131 131
 
132
-	}
132
+    }
133 133
 
134
-	function testOptionGroupDeletion(){
134
+    function testOptionGroupDeletion(){
135 135
 
136
-		$this->logInWithPermission('ADMIN');
137
-		$group = $this->objFromFixture('OptionGroup', 'color');
138
-		$group->write();
139
-		$groupID = $group->ID;
136
+        $this->logInWithPermission('ADMIN');
137
+        $group = $this->objFromFixture('OptionGroup', 'color');
138
+        $group->write();
139
+        $groupID = $group->ID;
140 140
 
141
-		$this->assertTrue($group->canDelete());
141
+        $this->assertTrue($group->canDelete());
142 142
 
143
-		$this->logOut();
144
-		$this->logInWithPermission('Product_CANCRUD');
143
+        $this->logOut();
144
+        $this->logInWithPermission('Product_CANCRUD');
145 145
 
146
-		$this->assertTrue($group->canDelete());
147
-		$group->delete();
146
+        $this->assertTrue($group->canDelete());
147
+        $group->delete();
148 148
 
149
-		$this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID')));
149
+        $this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID')));
150 150
 
151
-	}
151
+    }
152 152
 
153
-	function testOptionItemCreation(){
153
+    function testOptionItemCreation(){
154 154
 
155
-		$this->logInWithPermission('Product_CANCRUD');
156
-		$optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first();
157
-		$option = $this->objFromFixture('OptionItem', 'large');
158
-		$option->ProductOptionGroupID = $optionGroup->ID;
159
-		$option->write();
160
-		$optionID = $option->ID;
155
+        $this->logInWithPermission('Product_CANCRUD');
156
+        $optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first();
157
+        $option = $this->objFromFixture('OptionItem', 'large');
158
+        $option->ProductOptionGroupID = $optionGroup->ID;
159
+        $option->write();
160
+        $optionID = $option->ID;
161 161
 
162
-		$optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first();
162
+        $optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first();
163 163
 
164
-		$this->assertEquals($optionID, $optionItem->ID);
164
+        $this->assertEquals($optionID, $optionItem->ID);
165 165
 
166
-	}
166
+    }
167 167
 
168
-	function testOptionItemDeletion(){
168
+    function testOptionItemDeletion(){
169 169
 
170
-		$this->logInWithPermission('ADMIN');
171
-		$optionGroup = (OptionGroup::get()->first())
172
-			? OptionGroup::get()->first()
173
-			: OptionGroup::create();
174
-		if($optionGroup->ID == 0){
175
-			$optionGroup->Title = 'Size';
176
-			$optionGroup->write();
177
-		}
178
-		$option = $this->objFromFixture('OptionItem', 'small');
179
-		$option->ProductOptionGroupID = $optionGroup->ID;
180
-		$option->write();
181
-		$optionID = $option->ID;
170
+        $this->logInWithPermission('ADMIN');
171
+        $optionGroup = (OptionGroup::get()->first())
172
+            ? OptionGroup::get()->first()
173
+            : OptionGroup::create();
174
+        if($optionGroup->ID == 0){
175
+            $optionGroup->Title = 'Size';
176
+            $optionGroup->write();
177
+        }
178
+        $option = $this->objFromFixture('OptionItem', 'small');
179
+        $option->ProductOptionGroupID = $optionGroup->ID;
180
+        $option->write();
181
+        $optionID = $option->ID;
182 182
 
183
-		$this->assertTrue($option->canDelete());
183
+        $this->assertTrue($option->canDelete());
184 184
 
185
-		$this->logOut();
186
-		$this->logInWithPermission('Product_CANCRUD');
185
+        $this->logOut();
186
+        $this->logInWithPermission('Product_CANCRUD');
187 187
 
188
-		$this->assertTrue($option->canDelete());
189
-		$option->delete();
188
+        $this->assertTrue($option->canDelete());
189
+        $option->delete();
190 190
 
191
-		$this->assertFalse(in_array($optionID, OptionItem::get()->column('ID')));
191
+        $this->assertFalse(in_array($optionID, OptionItem::get()->column('ID')));
192 192
 
193
-	}
193
+    }
194 194
 
195 195
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 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');
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 	}
31 31
 
32
-	function testProductDeletion(){
32
+	function testProductDeletion() {
33 33
 
34 34
 		$this->logInWithPermission('Product_CANCRUD');
35 35
 		$product2 = $this->objFromFixture('ProductPage', 'product2');
@@ -39,22 +39,22 @@  discard block
 block discarded – undo
39 39
 		$product2->doPublish();
40 40
 		$this->assertTrue($product2->isPublished());
41 41
 
42
-		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
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) $versionsPostPublish[] = $versionRow;
45 45
 
46 46
 		$product2->delete();
47 47
 		$this->assertTrue(!$product2->isPublished());
48 48
 
49
-		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID);
49
+		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '.$productID);
50 50
 		$versionsPostDelete = array();
51
-		foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow;
51
+		foreach ($versions as $versionRow) $versionsPostDelete[] = $versionRow;
52 52
 
53 53
 		$this->assertTrue($versionsPostPublish == $versionsPostDelete);
54 54
 
55 55
 	}
56 56
 
57
-	function testProductTitleLeadingWhiteSpace(){
57
+	function testProductTitleLeadingWhiteSpace() {
58 58
 
59 59
 		$this->logInWithPermission('ADMIN');
60 60
 		$product = $this->objFromFixture('ProductPage', 'product1');
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 	}
68 68
 
69
-	function testProductTitleTrailingWhiteSpace(){
69
+	function testProductTitleTrailingWhiteSpace() {
70 70
 
71 71
 		$this->logInWithPermission('ADMIN');
72 72
 		$product = $this->objFromFixture('ProductPage', 'product1');
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 	}
80 80
 
81
-	function testProductCategoryCreation(){
81
+	function testProductCategoryCreation() {
82 82
 
83 83
 		$this->logInWithPermission('Product_CANCRUD');
84 84
 		$category = $this->objFromFixture('ProductCategory', 'apparel');
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	}
93 93
 
94
-	function testProductCategoryDeletion(){
94
+	function testProductCategoryDeletion() {
95 95
 
96 96
 		$this->logInWithPermission('Product_CANCRUD');
97 97
 		$category = $this->objFromFixture('ProductCategory', 'default');
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 
118 118
 		$category2->delete();
119 119
 
120
-		$this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID')));
120
+		$this->assertFalse(in_array($category2ID, ProductCategory::get()->column('ID')));
121 121
 
122 122
 	}
123 123
 
124
-	function testOptionGroupCreation(){
124
+	function testOptionGroupCreation() {
125 125
 
126 126
 		$this->logInWithPermission('Product_CANCRUD');
127 127
 		$group = $this->objFromFixture('OptionGroup', 'size');
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
 	}
133 133
 
134
-	function testOptionGroupDeletion(){
134
+	function testOptionGroupDeletion() {
135 135
 
136 136
 		$this->logInWithPermission('ADMIN');
137 137
 		$group = $this->objFromFixture('OptionGroup', 'color');
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
 	}
152 152
 
153
-	function testOptionItemCreation(){
153
+	function testOptionItemCreation() {
154 154
 
155 155
 		$this->logInWithPermission('Product_CANCRUD');
156 156
 		$optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first();
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 
166 166
 	}
167 167
 
168
-	function testOptionItemDeletion(){
168
+	function testOptionItemDeletion() {
169 169
 
170 170
 		$this->logInWithPermission('ADMIN');
171 171
 		$optionGroup = (OptionGroup::get()->first())
172 172
 			? OptionGroup::get()->first()
173 173
 			: OptionGroup::create();
174
-		if($optionGroup->ID == 0){
174
+		if ($optionGroup->ID == 0) {
175 175
 			$optionGroup->Title = 'Size';
176 176
 			$optionGroup->write();
177 177
 		}
Please login to merge, or discard this patch.
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.