@@ -19,13 +19,11 @@ |
||
19 | 19 | |
20 | 20 | use Cake\TestSuite\TestCase; |
21 | 21 | |
22 | -class ShopsTableTest extends TestCase |
|
23 | -{ |
|
22 | +class ShopsTableTest extends TestCase { |
|
24 | 23 | |
25 | 24 | public $fixtures = ['plugin.Multidimensional/Shopify.Shops']; |
26 | 25 | |
27 | - public function setUp() |
|
28 | - { |
|
26 | + public function setUp() { |
|
29 | 27 | parent::setUp(); |
30 | 28 | } |
31 | 29 | } |
@@ -19,13 +19,11 @@ |
||
19 | 19 | |
20 | 20 | use Cake\TestSuite\TestCase; |
21 | 21 | |
22 | -class AccessTokensTableTest extends TestCase |
|
23 | -{ |
|
22 | +class AccessTokensTableTest extends TestCase { |
|
24 | 23 | |
25 | 24 | public $fixtures = ['plugin.Multidimensional/Shopify.AccessTokens']; |
26 | 25 | |
27 | - public function setUp() |
|
28 | - { |
|
26 | + public function setUp() { |
|
29 | 27 | parent::setUp(); |
30 | 28 | } |
31 | 29 | } |
@@ -19,11 +19,9 @@ |
||
19 | 19 | |
20 | 20 | use Cake\TestSuite\TestCase; |
21 | 21 | |
22 | -class TableHelperTest extends TestCase |
|
23 | -{ |
|
22 | +class TableHelperTest extends TestCase { |
|
24 | 23 | |
25 | - public function setUp() |
|
26 | - { |
|
24 | + public function setUp() { |
|
27 | 25 | parent::setUp(); |
28 | 26 | } |
29 | 27 | } |
@@ -19,11 +19,9 @@ |
||
19 | 19 | |
20 | 20 | use Cake\TestSuite\TestCase; |
21 | 21 | |
22 | -class HeaderHelperTest extends TestCase |
|
23 | -{ |
|
22 | +class HeaderHelperTest extends TestCase { |
|
24 | 23 | |
25 | - public function setUp() |
|
26 | - { |
|
24 | + public function setUp() { |
|
27 | 25 | parent::setUp(); |
28 | 26 | } |
29 | 27 | } |
@@ -19,11 +19,9 @@ |
||
19 | 19 | |
20 | 20 | use Cake\TestSuite\TestCase; |
21 | 21 | |
22 | -class ShopifyInstallShellTest extends TestCase |
|
23 | -{ |
|
22 | +class ShopifyInstallShellTest extends TestCase { |
|
24 | 23 | |
25 | - public function setUp() |
|
26 | - { |
|
24 | + public function setUp() { |
|
27 | 25 | parent::setUp(); |
28 | 26 | } |
29 | 27 | } |
@@ -19,19 +19,16 @@ discard block |
||
19 | 19 | |
20 | 20 | use Cake\TestSuite\IntegrationTestCase; |
21 | 21 | |
22 | -class InstallControllerTest extends IntegrationTestCase |
|
23 | -{ |
|
22 | +class InstallControllerTest extends IntegrationTestCase { |
|
24 | 23 | |
25 | 24 | public $fixtures = ['plugin.Multidimensional/Shopify.Shops', |
26 | 25 | 'plugin.Multidimensional/Shopify.AccessTokens']; |
27 | 26 | |
28 | - public function setUp() |
|
29 | - { |
|
27 | + public function setUp() { |
|
30 | 28 | parent::setUp(); |
31 | 29 | } |
32 | 30 | |
33 | - public function testValidate() |
|
34 | - { |
|
31 | + public function testValidate() { |
|
35 | 32 | $this->markTestIncomplete('Not implemented yet.'); |
36 | 33 | /*$this->get('/shopify/install/'); |
37 | 34 | $this->assertResponseOk(); |
@@ -39,15 +36,13 @@ discard block |
||
39 | 36 | $this->assertResponseError();*/ |
40 | 37 | } |
41 | 38 | |
42 | - public function testIndex() |
|
43 | - { |
|
39 | + public function testIndex() { |
|
44 | 40 | $this->markTestIncomplete('Not implemented yet.'); |
45 | 41 | /*$this->get('/shopify/install/'); |
46 | 42 | $this->assertResponseOk();*/ |
47 | 43 | } |
48 | 44 | |
49 | - public function testRedirect() |
|
50 | - { |
|
45 | + public function testRedirect() { |
|
51 | 46 | $this->markTestIncomplete('Not implemented yet.'); |
52 | 47 | } |
53 | 48 | } |
@@ -24,15 +24,13 @@ discard block |
||
24 | 24 | use Cake\Network\Response; |
25 | 25 | use Cake\TestSuite\TestCase; |
26 | 26 | |
27 | -class ShopifyAPIComponentTest extends TestCase |
|
28 | -{ |
|
27 | +class ShopifyAPIComponentTest extends TestCase { |
|
29 | 28 | |
30 | 29 | public $component = null; |
31 | 30 | public $controller = null; |
32 | 31 | public $fixtures = ['plugin.Multidimensional/Shopify.Shops', 'plugin.Multidimensional/Shopify.AccessTokens']; |
33 | 32 | |
34 | - public function setUp() |
|
35 | - { |
|
33 | + public function setUp() { |
|
36 | 34 | parent::setUp(); |
37 | 35 | $request = new Request(); |
38 | 36 | $response = new Response(); |
@@ -46,44 +44,36 @@ discard block |
||
46 | 44 | $this->component->startup($event); |
47 | 45 | } |
48 | 46 | |
49 | - public function tearDown() |
|
50 | - { |
|
47 | + public function tearDown() { |
|
51 | 48 | parent::tearDown(); |
52 | 49 | unset($this->component, $this->controller); |
53 | 50 | } |
54 | 51 | |
55 | - public function testSetShopDomain() |
|
56 | - { |
|
52 | + public function testSetShopDomain() { |
|
57 | 53 | $this->markTestIncomplete('Not implemented yet.'); |
58 | 54 | } |
59 | 55 | |
60 | - public function testGetShopDomain() |
|
61 | - { |
|
56 | + public function testGetShopDomain() { |
|
62 | 57 | $this->markTestIncomplete('Not implemented yet.'); |
63 | 58 | } |
64 | 59 | |
65 | - public function testSetAccessToken() |
|
66 | - { |
|
60 | + public function testSetAccessToken() { |
|
67 | 61 | $this->markTestIncomplete('Not implemented yet.'); |
68 | 62 | } |
69 | 63 | |
70 | - public function testGetAuthorizeUrl() |
|
71 | - { |
|
64 | + public function testGetAuthorizeUrl() { |
|
72 | 65 | $this->markTestIncomplete('Not implemented yet.'); |
73 | 66 | } |
74 | 67 | |
75 | - public function testGetAccessToken() |
|
76 | - { |
|
68 | + public function testGetAccessToken() { |
|
77 | 69 | $this->markTestIncomplete('Not implemented yet.'); |
78 | 70 | } |
79 | 71 | |
80 | - public function testSetNonce() |
|
81 | - { |
|
72 | + public function testSetNonce() { |
|
82 | 73 | $this->markTestIncomplete('Not implemented yet.'); |
83 | 74 | } |
84 | 75 | |
85 | - public function testGetNonce() |
|
86 | - { |
|
76 | + public function testGetNonce() { |
|
87 | 77 | $this->markTestIncomplete('Not implemented yet.'); |
88 | 78 | } |
89 | 79 | } |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | use Cake\Network\Response; |
25 | 25 | use Cake\TestSuite\TestCase; |
26 | 26 | |
27 | -class ShopifyDatabaseComponentTest extends TestCase |
|
28 | -{ |
|
27 | +class ShopifyDatabaseComponentTest extends TestCase { |
|
29 | 28 | |
30 | 29 | public $component = null; |
31 | 30 | public $controller = null; |
@@ -33,8 +32,7 @@ discard block |
||
33 | 32 | public $fixtures = ['plugin.Multidimensional/Shopify.Shops', |
34 | 33 | 'plugin.Multidimensional/Shopify.AccessTokens']; |
35 | 34 | |
36 | - public function setUp() |
|
37 | - { |
|
35 | + public function setUp() { |
|
38 | 36 | parent::setUp(); |
39 | 37 | $request = new Request(); |
40 | 38 | $response = new Response(); |
@@ -48,34 +46,28 @@ discard block |
||
48 | 46 | $this->component->startup($event); |
49 | 47 | } |
50 | 48 | |
51 | - public function tearDown() |
|
52 | - { |
|
49 | + public function tearDown() { |
|
53 | 50 | parent::tearDown(); |
54 | 51 | unset($this->component, $this->controller); |
55 | 52 | } |
56 | 53 | |
57 | - public function testShopDataToDatabase() |
|
58 | - { |
|
54 | + public function testShopDataToDatabase() { |
|
59 | 55 | $this->markTestIncomplete('Not implemented yet.'); |
60 | 56 | } |
61 | 57 | |
62 | - public function testAccessTokenToDatabase() |
|
63 | - { |
|
58 | + public function testAccessTokenToDatabase() { |
|
64 | 59 | $this->markTestIncomplete('Not implemented yet.'); |
65 | 60 | } |
66 | 61 | |
67 | - public function testGetShopIdFromDomain() |
|
68 | - { |
|
62 | + public function testGetShopIdFromDomain() { |
|
69 | 63 | $this->markTestIncomplete('Not implemented yet.'); |
70 | 64 | } |
71 | 65 | |
72 | - public function testGetShopDataFromAccessToken() |
|
73 | - { |
|
66 | + public function testGetShopDataFromAccessToken() { |
|
74 | 67 | $this->markTestIncomplete('Not implemented yet.'); |
75 | 68 | } |
76 | 69 | |
77 | - public function testGetAccessTokenFromShopDomain() |
|
78 | - { |
|
70 | + public function testGetAccessTokenFromShopDomain() { |
|
79 | 71 | $this->markTestIncomplete('Not implemented yet.'); |
80 | 72 | } |
81 | 73 | } |
@@ -40,17 +40,17 @@ |
||
40 | 40 | |
41 | 41 | if (empty($this->api_key)) { |
42 | 42 | |
43 | - $controller = $this->_registry->getController(); |
|
43 | + $controller = $this->_registry->getController(); |
|
44 | 44 | |
45 | - if (isset($controller->request->api_key)) { |
|
45 | + if (isset($controller->request->api_key)) { |
|
46 | 46 | $this->api_key = $controller->request->api_key; |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
51 | 51 | $this->ShopifyAPI = $registry->load('Multidimensional/Shopify.ShopifyAPI', [ |
52 | 52 | 'api_key' => $this->api_key |
53 | - ]); |
|
53 | + ]); |
|
54 | 54 | |
55 | 55 | $this->ShopifyDatabase = $registry->load('Multidimensional/Shopify.ShopifyDatabase'); |
56 | 56 | } |
@@ -25,15 +25,13 @@ discard block |
||
25 | 25 | |
26 | 26 | use Multidimensional\Shopify\Auth\Event; |
27 | 27 | |
28 | -class ShopifyAuthAuthenticate extends BaseAuthenticate |
|
29 | -{ |
|
28 | +class ShopifyAuthAuthenticate extends BaseAuthenticate { |
|
30 | 29 | |
31 | 30 | public $api_key; |
32 | 31 | private $ShopifyAPI; |
33 | 32 | private $ShopifyDatabase; |
34 | 33 | |
35 | - public function __construct($registry, array $config = []) |
|
36 | - { |
|
34 | + public function __construct($registry, array $config = []) { |
|
37 | 35 | parent::__construct($registry, $config); |
38 | 36 | |
39 | 37 | $this->api_key = isset($config['api_key']) ? $config['api_key'] : ''; |
@@ -55,14 +53,12 @@ discard block |
||
55 | 53 | $this->ShopifyDatabase = $registry->load('Multidimensional/Shopify.ShopifyDatabase'); |
56 | 54 | } |
57 | 55 | |
58 | - public function authenticate(Request $request, Response $response) |
|
59 | - { |
|
56 | + public function authenticate(Request $request, Response $response) { |
|
60 | 57 | |
61 | 58 | return $this->getUser($request); |
62 | 59 | } |
63 | 60 | |
64 | - public function unauthenticated(Request $request, Response $response) |
|
65 | - { |
|
61 | + public function unauthenticated(Request $request, Response $response) { |
|
66 | 62 | |
67 | 63 | if (isset($request->query['hmac']) |
68 | 64 | && isset($request->query['shop'])) { |
@@ -84,8 +80,7 @@ discard block |
||
84 | 80 | return $response->location($this->_generateLoginUrl()); |
85 | 81 | } |
86 | 82 | |
87 | - public function getUser(Request $request) |
|
88 | - { |
|
83 | + public function getUser(Request $request) { |
|
89 | 84 | |
90 | 85 | $accessToken = $request->session()->read('shopify_access_token_' . $this->api_key); |
91 | 86 | $shopDomain = $request->session()->read('shopify_shop_domain_' . $this->api_key); |
@@ -125,31 +120,26 @@ discard block |
||
125 | 120 | return false; |
126 | 121 | } |
127 | 122 | |
128 | - protected function _authenticate(Request $request) |
|
129 | - { |
|
123 | + protected function _authenticate(Request $request) { |
|
130 | 124 | } |
131 | 125 | |
132 | - public function implementedEvents() |
|
133 | - { |
|
126 | + public function implementedEvents() { |
|
134 | 127 | return [ |
135 | 128 | 'Auth.afterIdentify' => 'afterIdentify', |
136 | 129 | 'Auth.logout' => 'logout' |
137 | 130 | ]; |
138 | 131 | } |
139 | 132 | |
140 | - public function afterIdentify(Event $event, array $user) |
|
141 | - { |
|
133 | + public function afterIdentify(Event $event, array $user) { |
|
142 | 134 | } |
143 | 135 | |
144 | - public function logout(Event $event, array $user) |
|
145 | - { |
|
136 | + public function logout(Event $event, array $user) { |
|
146 | 137 | |
147 | 138 | //$request->session()->delete('shopify_access_token_' . $this->api_key); |
148 | 139 | //$request->session()->delete('shopify_shop_domain_' . $this->api_key); |
149 | 140 | } |
150 | 141 | |
151 | - private function _generateLoginUrl() |
|
152 | - { |
|
142 | + private function _generateLoginUrl() { |
|
153 | 143 | return Router::url(['controller' => 'Install', 'action' => 'index', 'plugin' => 'Multidimensional/Shopify']); |
154 | 144 | } |
155 | 145 | } |