Completed
Push — master ( ac109f...19c432 )
by Aimeos
05:47
created
client/jsonapi/tests/Client/JsonApi/Locale/FactoryTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$context = \TestHelperJapi::getContext();
17 17
 		$templatePaths = \TestHelperJapi::getTemplatePaths();
18 18
 
19
-		$client = \Aimeos\Client\JsonApi\Locale\Factory::createClient( $context, $templatePaths, 'locale' );
20
-		$this->assertInstanceOf( '\Aimeos\Client\JsonApi\Iface', $client );
19
+		$client = \Aimeos\Client\JsonApi\Locale\Factory::createClient($context, $templatePaths, 'locale');
20
+		$this->assertInstanceOf('\Aimeos\Client\JsonApi\Iface', $client);
21 21
 	}
22 22
 
23 23
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 		$context = \TestHelperJapi::getContext();
27 27
 		$templatePaths = \TestHelperJapi::getTemplatePaths();
28 28
 
29
-		$this->setExpectedException( '\Aimeos\Client\JsonApi\Exception' );
30
-		\Aimeos\Client\JsonApi\Locale\Factory::createClient( $context, $templatePaths, '' );
29
+		$this->setExpectedException('\Aimeos\Client\JsonApi\Exception');
30
+		\Aimeos\Client\JsonApi\Locale\Factory::createClient($context, $templatePaths, '');
31 31
 	}
32 32
 
33 33
 
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 		$context = \TestHelperJapi::getContext();
37 37
 		$templatePaths = \TestHelperJapi::getTemplatePaths();
38 38
 
39
-		$this->setExpectedException( '\Aimeos\Client\JsonApi\Exception' );
40
-		\Aimeos\Client\JsonApi\Locale\Factory::createClient( $context, $templatePaths, '%^' );
39
+		$this->setExpectedException('\Aimeos\Client\JsonApi\Exception');
40
+		\Aimeos\Client\JsonApi\Locale\Factory::createClient($context, $templatePaths, '%^');
41 41
 	}
42 42
 
43 43
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		$context = \TestHelperJapi::getContext();
47 47
 		$templatePaths = \TestHelperJapi::getTemplatePaths();
48 48
 
49
-		$this->setExpectedException( '\Aimeos\Client\JsonApi\Exception' );
50
-		\Aimeos\Client\JsonApi\Locale\Factory::createClient( $context, $templatePaths, 'locale', '%^' );
49
+		$this->setExpectedException('\Aimeos\Client\JsonApi\Exception');
50
+		\Aimeos\Client\JsonApi\Locale\Factory::createClient($context, $templatePaths, 'locale', '%^');
51 51
 	}
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
client/jsonapi/tests/Client/JsonApi/Locale/StandardTest.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -22,20 +22,20 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJapi::getTemplatePaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Client\JsonApi\Locale\Standard( $this->context, $this->view, $templatePaths, 'locale' );
25
+		$this->object = new \Aimeos\Client\JsonApi\Locale\Standard($this->context, $this->view, $templatePaths, 'locale');
26 26
 	}
27 27
 
28 28
 
29 29
 	public function testGetItem()
30 30
 	{
31
-		$localeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'locale' );
31
+		$localeManager = \Aimeos\MShop\Factory::createManager($this->context, 'locale');
32 32
 		$search = $localeManager->createSearch();
33
-		$search->setSortations( [$search->sort( '+', 'locale.position' )] );
34
-		$search->setSlice( 0, 1 );
35
-		$localeItems = $localeManager->searchItems( $search );
33
+		$search->setSortations([$search->sort('+', 'locale.position')]);
34
+		$search->setSlice(0, 1);
35
+		$localeItems = $localeManager->searchItems($search);
36 36
 
37
-		if( ( $localeItem = reset( $localeItems ) ) === false ) {
38
-			throw new \Exception( 'No locale item found' );
37
+		if (($localeItem = reset($localeItems)) === false) {
38
+			throw new \Exception('No locale item found');
39 39
 		}
40 40
 
41 41
 
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 			)
47 47
 		);
48 48
 
49
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
50
-		$this->view->addHelper( 'param', $helper );
49
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
50
+		$this->view->addHelper('param', $helper);
51 51
 
52
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
53
-		$result = json_decode( (string) $response->getBody(), true );
52
+		$response = $this->object->get($this->view->request(), $this->view->response());
53
+		$result = json_decode((string) $response->getBody(), true);
54 54
 
55 55
 
56
-		$this->assertEquals( 200, $response->getStatusCode() );
57
-		$this->assertEquals( 1, count( $response->getHeader( 'Allow' ) ) );
58
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
56
+		$this->assertEquals(200, $response->getStatusCode());
57
+		$this->assertEquals(1, count($response->getHeader('Allow')));
58
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
59 59
 
60
-		$this->assertEquals( 1, $result['meta']['total'] );
61
-		$this->assertEquals( 'locale', $result['data']['type'] );
62
-		$this->assertGreaterThan( 0, $result['data']['attributes']['locale.id'] );
63
-		$this->assertEquals( 'de', $result['data']['attributes']['locale.languageid'] );
64
-		$this->assertEquals( 'EUR', $result['data']['attributes']['locale.currencyid'] );
60
+		$this->assertEquals(1, $result['meta']['total']);
61
+		$this->assertEquals('locale', $result['data']['type']);
62
+		$this->assertGreaterThan(0, $result['data']['attributes']['locale.id']);
63
+		$this->assertEquals('de', $result['data']['attributes']['locale.languageid']);
64
+		$this->assertEquals('EUR', $result['data']['attributes']['locale.currencyid']);
65 65
 
66
-		$this->assertArrayNotHasKey( 'errors', $result );
66
+		$this->assertArrayNotHasKey('errors', $result);
67 67
 	}
68 68
 
69 69
 
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
 			),
76 76
 			'sort' => 'locale.position',
77 77
 		);
78
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
79
-		$this->view->addHelper( 'param', $helper );
78
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
79
+		$this->view->addHelper('param', $helper);
80 80
 
81
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
82
-		$result = json_decode( (string) $response->getBody(), true );
81
+		$response = $this->object->get($this->view->request(), $this->view->response());
82
+		$result = json_decode((string) $response->getBody(), true);
83 83
 
84 84
 
85
-		$this->assertEquals( 200, $response->getStatusCode() );
86
-		$this->assertEquals( 1, count( $response->getHeader( 'Allow' ) ) );
87
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
85
+		$this->assertEquals(200, $response->getStatusCode());
86
+		$this->assertEquals(1, count($response->getHeader('Allow')));
87
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
88 88
 
89
-		$this->assertEquals( 1, $result['meta']['total'] );
90
-		$this->assertEquals( 1, count( $result['data'] ) );
91
-		$this->assertEquals( 'locale', $result['data'][0]['type'] );
92
-		$this->assertEquals( 3, count( $result['data'][0]['attributes'] ) );
93
-		$this->assertEquals( 'en', $result['data'][0]['attributes']['locale.languageid'] );
94
-		$this->assertEquals( 'EUR', $result['data'][0]['attributes']['locale.currencyid'] );
89
+		$this->assertEquals(1, $result['meta']['total']);
90
+		$this->assertEquals(1, count($result['data']));
91
+		$this->assertEquals('locale', $result['data'][0]['type']);
92
+		$this->assertEquals(3, count($result['data'][0]['attributes']));
93
+		$this->assertEquals('en', $result['data'][0]['attributes']['locale.languageid']);
94
+		$this->assertEquals('EUR', $result['data'][0]['attributes']['locale.currencyid']);
95 95
 
96
-		$this->assertArrayNotHasKey( 'errors', $result );
96
+		$this->assertArrayNotHasKey('errors', $result);
97 97
 	}
98 98
 
99 99
 
@@ -101,20 +101,20 @@  discard block
 block discarded – undo
101 101
 	{
102 102
 		$params = array(
103 103
 			'filter' => array(
104
-				'>=' => array( 'locale.position' => 0 ),
104
+				'>=' => array('locale.position' => 0),
105 105
 			),
106 106
 			'sort' => '-locale.position',
107 107
 		);
108
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
109
-		$this->view->addHelper( 'param', $helper );
108
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
109
+		$this->view->addHelper('param', $helper);
110 110
 
111
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
112
-		$result = json_decode( (string) $response->getBody(), true );
111
+		$response = $this->object->get($this->view->request(), $this->view->response());
112
+		$result = json_decode((string) $response->getBody(), true);
113 113
 
114 114
 
115
-		$this->assertEquals( 200, $response->getStatusCode() );
116
-		$this->assertEquals( 1, $result['meta']['total'] );
117
-		$this->assertArrayNotHasKey( 'errors', $result );
115
+		$this->assertEquals(200, $response->getStatusCode());
116
+		$this->assertEquals(1, $result['meta']['total']);
117
+		$this->assertArrayNotHasKey('errors', $result);
118 118
 	}
119 119
 
120 120
 
@@ -122,21 +122,21 @@  discard block
 block discarded – undo
122 122
 	{
123 123
 		$templatePaths = \TestHelperJapi::getTemplatePaths();
124 124
 
125
-		$object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Locale\Standard' )
126
-			->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'locale'] )
127
-			->setMethods( ['getItems'] )
125
+		$object = $this->getMockBuilder('\Aimeos\Client\JsonApi\Locale\Standard')
126
+			->setConstructorArgs([$this->context, $this->view, $templatePaths, 'locale'])
127
+			->setMethods(['getItems'])
128 128
 			->getMock();
129 129
 
130
-		$object->expects( $this->once() )->method( 'getItems' )
131
-			->will( $this->throwException( new \Aimeos\MShop\Exception() ) );
130
+		$object->expects($this->once())->method('getItems')
131
+			->will($this->throwException(new \Aimeos\MShop\Exception()));
132 132
 
133 133
 
134
-		$response = $object->get( $this->view->request(), $this->view->response() );
135
-		$result = json_decode( (string) $response->getBody(), true );
134
+		$response = $object->get($this->view->request(), $this->view->response());
135
+		$result = json_decode((string) $response->getBody(), true);
136 136
 
137 137
 
138
-		$this->assertEquals( 404, $response->getStatusCode() );
139
-		$this->assertArrayHasKey( 'errors', $result );
138
+		$this->assertEquals(404, $response->getStatusCode());
139
+		$this->assertArrayHasKey('errors', $result);
140 140
 	}
141 141
 
142 142
 
@@ -144,20 +144,20 @@  discard block
 block discarded – undo
144 144
 	{
145 145
 		$templatePaths = \TestHelperJapi::getTemplatePaths();
146 146
 
147
-		$object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Locale\Standard' )
148
-			->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'locale'] )
149
-			->setMethods( ['getItems'] )
147
+		$object = $this->getMockBuilder('\Aimeos\Client\JsonApi\Locale\Standard')
148
+			->setConstructorArgs([$this->context, $this->view, $templatePaths, 'locale'])
149
+			->setMethods(['getItems'])
150 150
 			->getMock();
151 151
 
152
-		$object->expects( $this->once() )->method( 'getItems' )
153
-			->will( $this->throwException( new \Exception() ) );
152
+		$object->expects($this->once())->method('getItems')
153
+			->will($this->throwException(new \Exception()));
154 154
 
155 155
 
156
-		$response = $object->get( $this->view->request(), $this->view->response() );
157
-		$result = json_decode( (string) $response->getBody(), true );
156
+		$response = $object->get($this->view->request(), $this->view->response());
157
+		$result = json_decode((string) $response->getBody(), true);
158 158
 
159 159
 
160
-		$this->assertEquals( 500, $response->getStatusCode() );
161
-		$this->assertArrayHasKey( 'errors', $result );
160
+		$this->assertEquals(500, $response->getStatusCode());
161
+		$this->assertArrayHasKey('errors', $result);
162 162
 	}
163 163
 }
164 164
\ No newline at end of file
Please login to merge, or discard this patch.
client/jsonapi/src/Client/JsonApi/Common/Factory/Iface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,5 +28,5 @@
 block discarded – undo
28 28
 	 * @param string|null $name Name of the client implementation ("Standard" if null)
29 29
 	 * @return \Aimeos\Client\JsonApi\Iface Client Interface
30 30
 	 */
31
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $path, $name = null );
31
+	public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $path, $name = null);
32 32
 }
Please login to merge, or discard this patch.