Completed
Push — master ( 7ad21f...0bf26f )
by Aimeos
01:53
created
admin/jsonadm/tests/Admin/JsonAdm/Plugin/Config/StandardTest.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Plugin\Config\Standard( $this->context, 'plugin/config' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Plugin\Config\Standard($this->context, 'plugin/config');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -32,26 +32,26 @@  discard block
 block discarded – undo
32 32
 		$params = array(
33 33
 			'id' => 'Autofill,Log',
34 34
 		);
35
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
36
-		$this->view->addHelper( 'param', $helper );
37
-
38
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
39
-		$result = json_decode( (string) $response->getBody(), true );
40
-
41
-		$this->assertEquals( 200, $response->getStatusCode() );
42
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
43
-
44
-		$this->assertEquals( 8, $result['meta']['total'] );
45
-		$this->assertInternalType( 'array', $result['data'] );
46
-		$this->assertEquals( 'autofill.address', $result['data'][0]['id'] );
47
-		$this->assertEquals( 'autofill.delivery', $result['data'][1]['id'] );
48
-		$this->assertEquals( 'autofill.deliverycode', $result['data'][2]['id'] );
49
-		$this->assertEquals( 'autofill.payment', $result['data'][3]['id'] );
50
-		$this->assertEquals( 'autofill.paymentcode', $result['data'][4]['id'] );
51
-		$this->assertEquals( 'autofill.useorder', $result['data'][5]['id'] );
52
-		$this->assertEquals( 'autofill.orderaddress', $result['data'][6]['id'] );
53
-		$this->assertEquals( 'autofill.orderservice', $result['data'][7]['id'] );
54
-
55
-		$this->assertArrayNotHasKey( 'errors', $result );
35
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
36
+		$this->view->addHelper('param', $helper);
37
+
38
+		$response = $this->object->get($this->view->request(), $this->view->response());
39
+		$result = json_decode((string) $response->getBody(), true);
40
+
41
+		$this->assertEquals(200, $response->getStatusCode());
42
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
43
+
44
+		$this->assertEquals(8, $result['meta']['total']);
45
+		$this->assertInternalType('array', $result['data']);
46
+		$this->assertEquals('autofill.address', $result['data'][0]['id']);
47
+		$this->assertEquals('autofill.delivery', $result['data'][1]['id']);
48
+		$this->assertEquals('autofill.deliverycode', $result['data'][2]['id']);
49
+		$this->assertEquals('autofill.payment', $result['data'][3]['id']);
50
+		$this->assertEquals('autofill.paymentcode', $result['data'][4]['id']);
51
+		$this->assertEquals('autofill.useorder', $result['data'][5]['id']);
52
+		$this->assertEquals('autofill.orderaddress', $result['data'][6]['id']);
53
+		$this->assertEquals('autofill.orderservice', $result['data'][7]['id']);
54
+
55
+		$this->assertArrayNotHasKey('errors', $result);
56 56
 	}
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/FactoryTest.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 		$context = \TestHelperJadm::getContext();
17 17
 		$aimeos = \TestHelperJadm::getAimeos();
18 18
 
19
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
20
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
21
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Order\\Standard', $client );
19
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
20
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
21
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Order\\Standard', $client);
22 22
 	}
23 23
 
24 24
 
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 		$context = \TestHelperJadm::getContext();
28 28
 		$aimeos = \TestHelperJadm::getAimeos();
29 29
 
30
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order/base' );
31
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
32
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Order\\Base\\Standard', $client );
30
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order/base');
31
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
32
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Order\\Base\\Standard', $client);
33 33
 	}
34 34
 
35 35
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 		$context = \TestHelperJadm::getContext();
39 39
 		$aimeos = \TestHelperJadm::getAimeos();
40 40
 
41
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'stock/type' );
42
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
43
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Standard', $client );
41
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'stock/type');
42
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
43
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Standard', $client);
44 44
 	}
45 45
 
46 46
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 		$context = \TestHelperJadm::getContext();
50 50
 		$aimeos = \TestHelperJadm::getAimeos();
51 51
 
52
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, '' );
53
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
54
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Standard', $client );
52
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, '');
53
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
54
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Standard', $client);
55 55
 	}
56 56
 
57 57
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 		$context = \TestHelperJadm::getContext();
61 61
 		$aimeos = \TestHelperJadm::getAimeos();
62 62
 
63
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
64
-		\Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, '%^' );
63
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
64
+		\Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, '%^');
65 65
 	}
66 66
 
67 67
 
@@ -70,68 +70,68 @@  discard block
 block discarded – undo
70 70
 		$context = \TestHelperJadm::getContext();
71 71
 		$aimeos = \TestHelperJadm::getAimeos();
72 72
 
73
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
74
-		\Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, '', '%^' );
73
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
74
+		\Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, '', '%^');
75 75
 	}
76 76
 
77 77
 
78 78
 	public function testClear()
79 79
 	{
80
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
80
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
81 81
 
82 82
 		$context = \TestHelperJadm::getContext();
83 83
 		$aimeos = \TestHelperJadm::getAimeos();
84 84
 
85
-		$client1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
85
+		$client1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
86 86
 		\Aimeos\Admin\JsonAdm\Factory::clear();
87
-		$client2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
87
+		$client2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
88 88
 
89
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
89
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
90 90
 
91
-		$this->assertNotSame( $client1, $client2 );
91
+		$this->assertNotSame($client1, $client2);
92 92
 	}
93 93
 
94 94
 
95 95
 	public function testClearSite()
96 96
 	{
97
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
97
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
98 98
 
99 99
 		$context = \TestHelperJadm::getContext();
100 100
 		$aimeos = \TestHelperJadm::getAimeos();
101 101
 
102
-		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
103
-		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order/base' );
104
-		\Aimeos\Admin\JsonAdm\Factory::clear( (string) $context );
102
+		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
103
+		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order/base');
104
+		\Aimeos\Admin\JsonAdm\Factory::clear((string) $context);
105 105
 
106
-		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
107
-		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order/base' );
106
+		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
107
+		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order/base');
108 108
 
109
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
109
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
110 110
 
111
-		$this->assertNotSame( $cntlA1, $cntlA2 );
112
-		$this->assertNotSame( $cntlB1, $cntlB2 );
111
+		$this->assertNotSame($cntlA1, $cntlA2);
112
+		$this->assertNotSame($cntlB1, $cntlB2);
113 113
 	}
114 114
 
115 115
 
116 116
 	public function testClearSpecific()
117 117
 	{
118
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
118
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
119 119
 
120 120
 		$context = \TestHelperJadm::getContext();
121 121
 		$aimeos = \TestHelperJadm::getAimeos();
122 122
 
123
-		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
124
-		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order/base' );
123
+		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
124
+		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order/base');
125 125
 
126
-		\Aimeos\Admin\JsonAdm\Factory::clear( (string) $context, 'order' );
126
+		\Aimeos\Admin\JsonAdm\Factory::clear((string) $context, 'order');
127 127
 
128
-		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
129
-		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order/base' );
128
+		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
129
+		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order/base');
130 130
 
131
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
131
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
132 132
 
133
-		$this->assertNotSame( $cntlA1, $cntlA2 );
134
-		$this->assertSame( $cntlB1, $cntlB2 );
133
+		$this->assertNotSame($cntlA1, $cntlA2);
134
+		$this->assertSame($cntlB1, $cntlB2);
135 135
 	}
136 136
 
137 137
 }
138 138
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Attribute/StandardTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Attribute\Standard( $this->context, 'attribute' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Attribute\Standard($this->context, 'attribute');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		$params = array(
33 33
 			'filter' => array(
34
-				'==' => array( 'attribute.code' => 's' )
34
+				'==' => array('attribute.code' => 's')
35 35
 			),
36 36
 			'include' => 'text'
37 37
 		);
38
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
39
-		$this->view->addHelper( 'param', $helper );
38
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
39
+		$this->view->addHelper('param', $helper);
40 40
 
41
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
42
-		$result = json_decode( (string) $response->getBody(), true );
41
+		$response = $this->object->get($this->view->request(), $this->view->response());
42
+		$result = json_decode((string) $response->getBody(), true);
43 43
 
44 44
 
45
-		$this->assertEquals( 200, $response->getStatusCode() );
46
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
45
+		$this->assertEquals(200, $response->getStatusCode());
46
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
47 47
 
48
-		$this->assertEquals( 1, $result['meta']['total'] );
49
-		$this->assertEquals( 1, count( $result['data'] ) );
50
-		$this->assertEquals( 'attribute', $result['data'][0]['type'] );
51
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['text'] ) );
52
-		$this->assertEquals( 1, count( $result['included'] ) );
48
+		$this->assertEquals(1, $result['meta']['total']);
49
+		$this->assertEquals(1, count($result['data']));
50
+		$this->assertEquals('attribute', $result['data'][0]['type']);
51
+		$this->assertEquals(1, count($result['data'][0]['relationships']['text']));
52
+		$this->assertEquals(1, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Text/StandardTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Text\Standard( $this->context, 'text' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Text\Standard($this->context, 'text');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		$params = array(
33 33
 			'filter' => array(
34
-				'==' => array( 'text.label' => 'misc_long_desc' )
34
+				'==' => array('text.label' => 'misc_long_desc')
35 35
 			),
36 36
 			'include' => 'media'
37 37
 		);
38
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
39
-		$this->view->addHelper( 'param', $helper );
38
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
39
+		$this->view->addHelper('param', $helper);
40 40
 
41
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
42
-		$result = json_decode( (string) $response->getBody(), true );
41
+		$response = $this->object->get($this->view->request(), $this->view->response());
42
+		$result = json_decode((string) $response->getBody(), true);
43 43
 
44 44
 
45
-		$this->assertEquals( 200, $response->getStatusCode() );
46
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
45
+		$this->assertEquals(200, $response->getStatusCode());
46
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
47 47
 
48
-		$this->assertEquals( 1, $result['meta']['total'] );
49
-		$this->assertEquals( 1, count( $result['data'] ) );
50
-		$this->assertEquals( 'text', $result['data'][0]['type'] );
51
-		$this->assertEquals( 4, count( $result['data'][0]['relationships']['media'] ) );
52
-		$this->assertEquals( 4, count( $result['included'] ) );
48
+		$this->assertEquals(1, $result['meta']['total']);
49
+		$this->assertEquals(1, count($result['data']));
50
+		$this->assertEquals('text', $result['data'][0]['type']);
51
+		$this->assertEquals(4, count($result['data'][0]['relationships']['media']));
52
+		$this->assertEquals(4, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Coupon/Config/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Coupon\Config\Standard( $this->context, 'coupon/config' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Coupon\Config\Standard($this->context, 'coupon/config');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 		$params = array(
33 33
 			'id' => 'Example,Required,BasketValues',
34 34
 		);
35
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
36
-		$this->view->addHelper( 'param', $helper );
35
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
36
+		$this->view->addHelper('param', $helper);
37 37
 
38
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
39
-		$result = json_decode( (string) $response->getBody(), true );
38
+		$response = $this->object->get($this->view->request(), $this->view->response());
39
+		$result = json_decode((string) $response->getBody(), true);
40 40
 
41
-		$this->assertEquals( 200, $response->getStatusCode() );
42
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
41
+		$this->assertEquals(200, $response->getStatusCode());
42
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
43 43
 
44
-		$this->assertEquals( 2, $result['meta']['total'] );
45
-		$this->assertInternalType( 'array', $result['data'] );
46
-		$this->assertEquals( 'basketvalues.total-value-min', $result['data'][0]['id'] );
47
-		$this->assertEquals( 'basketvalues.total-value-max', $result['data'][1]['id'] );
44
+		$this->assertEquals(2, $result['meta']['total']);
45
+		$this->assertInternalType('array', $result['data']);
46
+		$this->assertEquals('basketvalues.total-value-min', $result['data'][0]['id']);
47
+		$this->assertEquals('basketvalues.total-value-max', $result['data'][1]['id']);
48 48
 
49
-		$this->assertArrayNotHasKey( 'errors', $result );
49
+		$this->assertArrayNotHasKey('errors', $result);
50 50
 	}
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Service/Config/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Service\Config\Standard( $this->context, 'service/config' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Service\Config\Standard($this->context, 'service/config');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 			'id' => 'DirectDebit,Category',
34 34
 			'type' => 'payment',
35 35
 		);
36
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
37
-		$this->view->addHelper( 'param', $helper );
36
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
37
+		$this->view->addHelper('param', $helper);
38 38
 
39
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
40
-		$result = json_decode( (string) $response->getBody(), true );
39
+		$response = $this->object->get($this->view->request(), $this->view->response());
40
+		$result = json_decode((string) $response->getBody(), true);
41 41
 
42
-		$this->assertEquals( 200, $response->getStatusCode() );
43
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
42
+		$this->assertEquals(200, $response->getStatusCode());
43
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
44 44
 
45
-		$this->assertEquals( 2, $result['meta']['total'] );
46
-		$this->assertInternalType( 'array', $result['data'] );
47
-		$this->assertEquals( 'category.include', $result['data'][0]['id'] );
48
-		$this->assertEquals( 'category.exclude', $result['data'][1]['id'] );
45
+		$this->assertEquals(2, $result['meta']['total']);
46
+		$this->assertInternalType('array', $result['data']);
47
+		$this->assertEquals('category.include', $result['data'][0]['id']);
48
+		$this->assertEquals('category.exclude', $result['data'][1]['id']);
49 49
 
50
-		$this->assertArrayNotHasKey( 'errors', $result );
50
+		$this->assertArrayNotHasKey('errors', $result);
51 51
 	}
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Service/StandardTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Service\Standard( $this->context, 'service' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Service\Standard($this->context, 'service');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		$params = array(
33 33
 			'filter' => array(
34
-				'==' => array( 'service.code' => 'unitpaymentcode' )
34
+				'==' => array('service.code' => 'unitpaymentcode')
35 35
 			),
36 36
 			'include' => 'text'
37 37
 		);
38
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
39
-		$this->view->addHelper( 'param', $helper );
38
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
39
+		$this->view->addHelper('param', $helper);
40 40
 
41
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
42
-		$result = json_decode( (string) $response->getBody(), true );
41
+		$response = $this->object->get($this->view->request(), $this->view->response());
42
+		$result = json_decode((string) $response->getBody(), true);
43 43
 
44 44
 
45
-		$this->assertEquals( 200, $response->getStatusCode() );
46
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
45
+		$this->assertEquals(200, $response->getStatusCode());
46
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
47 47
 
48
-		$this->assertEquals( 1, $result['meta']['total'] );
49
-		$this->assertEquals( 1, count( $result['data'] ) );
50
-		$this->assertEquals( 'service', $result['data'][0]['type'] );
51
-		$this->assertEquals( 3, count( $result['data'][0]['relationships']['text'] ) );
52
-		$this->assertEquals( 3, count( $result['included'] ) );
48
+		$this->assertEquals(1, $result['meta']['total']);
49
+		$this->assertEquals(1, count($result['data']));
50
+		$this->assertEquals('service', $result['data'][0]['type']);
51
+		$this->assertEquals(3, count($result['data'][0]['relationships']['text']));
52
+		$this->assertEquals(3, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Locale/Site/StandardTest.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -21,34 +21,34 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Locale\Site\Standard( $this->context, 'locale/site' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Locale\Site\Standard($this->context, 'locale/site');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
30 30
 	public function testGet()
31 31
 	{
32 32
 		$params = array(
33
-			'id' => $this->getSiteItem( 'unittest' )->getId(),
33
+			'id' => $this->getSiteItem('unittest')->getId(),
34 34
 			'filter' => array(
35
-				'==' => array( 'locale.status' => 0 )
35
+				'==' => array('locale.status' => 0)
36 36
 			),
37 37
 		);
38
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
39
-		$this->view->addHelper( 'param', $helper );
38
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
39
+		$this->view->addHelper('param', $helper);
40 40
 
41
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
42
-		$result = json_decode( (string) $response->getBody(), true );
41
+		$response = $this->object->get($this->view->request(), $this->view->response());
42
+		$result = json_decode((string) $response->getBody(), true);
43 43
 
44 44
 
45
-		$this->assertEquals( 200, $response->getStatusCode() );
46
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
45
+		$this->assertEquals(200, $response->getStatusCode());
46
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
47 47
 
48
-		$this->assertEquals( 1, $result['meta']['total'] );
49
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
48
+		$this->assertEquals(1, $result['meta']['total']);
49
+		$this->assertEquals('locale/site', $result['data']['type']);
50 50
 
51
-		$this->assertArrayNotHasKey( 'errors', $result );
51
+		$this->assertArrayNotHasKey('errors', $result);
52 52
 	}
53 53
 
54 54
 
@@ -56,124 +56,124 @@  discard block
 block discarded – undo
56 56
 	{
57 57
 		$params = array(
58 58
 			'filter' => array(
59
-				'==' => array( 'locale.site.code' => 'unittest' )
59
+				'==' => array('locale.site.code' => 'unittest')
60 60
 			),
61 61
 		);
62
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
63
-		$this->view->addHelper( 'param', $helper );
62
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
63
+		$this->view->addHelper('param', $helper);
64 64
 
65
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
66
-		$result = json_decode( (string) $response->getBody(), true );
65
+		$response = $this->object->get($this->view->request(), $this->view->response());
66
+		$result = json_decode((string) $response->getBody(), true);
67 67
 
68 68
 
69
-		$this->assertEquals( 200, $response->getStatusCode() );
70
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
69
+		$this->assertEquals(200, $response->getStatusCode());
70
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
71 71
 
72
-		$this->assertEquals( 1, $result['meta']['total'] );
73
-		$this->assertEquals( 1, count( $result['data'] ) );
74
-		$this->assertEquals( 'locale/site', $result['data'][0]['type'] );
72
+		$this->assertEquals(1, $result['meta']['total']);
73
+		$this->assertEquals(1, count($result['data']));
74
+		$this->assertEquals('locale/site', $result['data'][0]['type']);
75 75
 
76
-		$this->assertArrayNotHasKey( 'errors', $result );
76
+		$this->assertArrayNotHasKey('errors', $result);
77 77
 	}
78 78
 
79 79
 
80 80
 	public function testPatch()
81 81
 	{
82
-		$stub = $this->getSiteMock( array( 'getItem', 'moveItem', 'saveItem' ) );
82
+		$stub = $this->getSiteMock(array('getItem', 'moveItem', 'saveItem'));
83 83
 		$item = $stub->createItem();
84 84
 
85
-		$stub->expects( $this->once() )->method( 'saveItem' )
86
-			->will( $this->returnValue( $stub->createItem() ) );
87
-		$stub->expects( $this->exactly( 2 ) )->method( 'getItem' ) // 2x due to decorator
88
-			->will( $this->returnValue( $item ) );
85
+		$stub->expects($this->once())->method('saveItem')
86
+			->will($this->returnValue($stub->createItem()));
87
+		$stub->expects($this->exactly(2))->method('getItem') // 2x due to decorator
88
+			->will($this->returnValue($item));
89 89
 
90 90
 
91
-		$params = array( 'id' => '-1' );
92
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
93
-		$this->view->addHelper( 'param', $helper );
91
+		$params = array('id' => '-1');
92
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
93
+		$this->view->addHelper('param', $helper);
94 94
 
95 95
 		$body = '{"data": {"parentid": "1", "targetid": 2, "type": "locale/site", "attributes": {"locale.site.label": "test"}}}';
96
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
96
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
97 97
 
98
-		$response = $this->object->patch( $request, $this->view->response() );
99
-		$result = json_decode( (string) $response->getBody(), true );
98
+		$response = $this->object->patch($request, $this->view->response());
99
+		$result = json_decode((string) $response->getBody(), true);
100 100
 
101 101
 
102
-		$this->assertEquals( 200, $response->getStatusCode() );
103
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
102
+		$this->assertEquals(200, $response->getStatusCode());
103
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
104 104
 
105
-		$this->assertEquals( 1, $result['meta']['total'] );
106
-		$this->assertArrayHasKey( 'data', $result );
107
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
105
+		$this->assertEquals(1, $result['meta']['total']);
106
+		$this->assertArrayHasKey('data', $result);
107
+		$this->assertEquals('locale/site', $result['data']['type']);
108 108
 
109
-		$this->assertArrayNotHasKey( 'included', $result );
110
-		$this->assertArrayNotHasKey( 'errors', $result );
109
+		$this->assertArrayNotHasKey('included', $result);
110
+		$this->assertArrayNotHasKey('errors', $result);
111 111
 	}
112 112
 
113 113
 
114 114
 	public function testPost()
115 115
 	{
116
-		$stub = $this->getSiteMock( array( 'getItem', 'insertItem' ) );
116
+		$stub = $this->getSiteMock(array('getItem', 'insertItem'));
117 117
 		$item = $stub->createItem();
118 118
 
119
-		$stub->expects( $this->any() )->method( 'getItem' )
120
-			->will( $this->returnValue( $item ) );
121
-		$stub->expects( $this->once() )->method( 'insertItem' );
119
+		$stub->expects($this->any())->method('getItem')
120
+			->will($this->returnValue($item));
121
+		$stub->expects($this->once())->method('insertItem');
122 122
 
123 123
 
124 124
 		$body = '{"data": {"type": "locale/site", "attributes": {"locale.site.code": "unittest", "locale.site.label": "Unit test"}}}';
125
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
125
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
126 126
 
127
-		$response = $this->object->post( $request, $this->view->response() );
128
-		$result = json_decode( (string) $response->getBody(), true );
127
+		$response = $this->object->post($request, $this->view->response());
128
+		$result = json_decode((string) $response->getBody(), true);
129 129
 
130 130
 
131
-		$this->assertEquals( 201, $response->getStatusCode() );
132
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
131
+		$this->assertEquals(201, $response->getStatusCode());
132
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
133 133
 
134
-		$this->assertEquals( 1, $result['meta']['total'] );
135
-		$this->assertArrayHasKey( 'data', $result );
136
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
134
+		$this->assertEquals(1, $result['meta']['total']);
135
+		$this->assertArrayHasKey('data', $result);
136
+		$this->assertEquals('locale/site', $result['data']['type']);
137 137
 
138
-		$this->assertArrayNotHasKey( 'included', $result );
139
-		$this->assertArrayNotHasKey( 'errors', $result );
138
+		$this->assertArrayNotHasKey('included', $result);
139
+		$this->assertArrayNotHasKey('errors', $result);
140 140
 	}
141 141
 
142 142
 
143
-	protected function getSiteItem( $code )
143
+	protected function getSiteItem($code)
144 144
 	{
145
-		$manager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $this->context )->getSubManager( 'site' );
145
+		$manager = \Aimeos\MShop\Locale\Manager\Factory::createManager($this->context)->getSubManager('site');
146 146
 		$search = $manager->createSearch();
147
-		$search->setConditions( $search->compare( '==', 'locale.site.code', $code ) );
148
-		$items = $manager->searchItems( $search );
147
+		$search->setConditions($search->compare('==', 'locale.site.code', $code));
148
+		$items = $manager->searchItems($search);
149 149
 
150
-		if( ( $item = reset( $items ) ) === false ) {
151
-			throw new \RuntimeException( sprintf( 'No locale site item with code "%1$s" found', $code ) );
150
+		if (($item = reset($items)) === false) {
151
+			throw new \RuntimeException(sprintf('No locale site item with code "%1$s" found', $code));
152 152
 		}
153 153
 
154 154
 		return $item;
155 155
 	}
156 156
 
157 157
 
158
-	protected function getSiteMock( array $methods )
158
+	protected function getSiteMock(array $methods)
159 159
 	{
160 160
 		$name = 'AdminJsonAdmStandard';
161
-		$this->context->getConfig()->set( 'mshop/locale/manager/name', $name );
161
+		$this->context->getConfig()->set('mshop/locale/manager/name', $name);
162 162
 
163
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Locale\\Manager\\Standard' )
164
-			->setConstructorArgs( array( $this->context ) )
165
-			->setMethods( array( 'getSubManager' ) )
163
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Locale\\Manager\\Standard')
164
+			->setConstructorArgs(array($this->context))
165
+			->setMethods(array('getSubManager'))
166 166
 			->getMock();
167 167
 
168
-		$siteStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Locale\\Manager\\Site\\Standard' )
169
-			->setConstructorArgs( array( $this->context ) )
170
-			->setMethods( $methods )
168
+		$siteStub = $this->getMockBuilder('\\Aimeos\\MShop\\Locale\\Manager\\Site\\Standard')
169
+			->setConstructorArgs(array($this->context))
170
+			->setMethods($methods)
171 171
 			->getMock();
172 172
 
173
-		$stub->expects( $this->once() )->method( 'getSubManager' )
174
-			->will( $this->returnValue( $siteStub ) );
173
+		$stub->expects($this->once())->method('getSubManager')
174
+			->will($this->returnValue($siteStub));
175 175
 
176
-		\Aimeos\MShop\Locale\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Locale\\Manager\\' . $name, $stub );
176
+		\Aimeos\MShop\Locale\Manager\Factory::injectManager('\\Aimeos\\MShop\\Locale\\Manager\\' . $name, $stub);
177 177
 
178 178
 		return $siteStub;
179 179
 	}
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Customer/StandardTest.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Customer\Standard( $this->context, 'customer' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Customer\Standard($this->context, 'customer');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -31,28 +31,28 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		$params = array(
33 33
 			'filter' => array(
34
-				'==' => array( 'customer.code' => 'UTC001' )
34
+				'==' => array('customer.code' => 'UTC001')
35 35
 			),
36 36
 			'include' => 'text,customer/address'
37 37
 		);
38
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
39
-		$this->view->addHelper( 'param', $helper );
38
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
39
+		$this->view->addHelper('param', $helper);
40 40
 
41
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
42
-		$result = json_decode( (string) $response->getBody(), true );
41
+		$response = $this->object->get($this->view->request(), $this->view->response());
42
+		$result = json_decode((string) $response->getBody(), true);
43 43
 
44 44
 
45
-		$this->assertEquals( 200, $response->getStatusCode() );
46
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
45
+		$this->assertEquals(200, $response->getStatusCode());
46
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
47 47
 
48
-		$this->assertEquals( 1, $result['meta']['total'] );
49
-		$this->assertEquals( 1, count( $result['data'] ) );
50
-		$this->assertEquals( 'customer', $result['data'][0]['type'] );
51
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['text'] ) );
52
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['customer/address'] ) );
53
-		$this->assertEquals( 2, count( $result['included'] ) );
48
+		$this->assertEquals(1, $result['meta']['total']);
49
+		$this->assertEquals(1, count($result['data']));
50
+		$this->assertEquals('customer', $result['data'][0]['type']);
51
+		$this->assertEquals(1, count($result['data'][0]['relationships']['text']));
52
+		$this->assertEquals(1, count($result['data'][0]['relationships']['customer/address']));
53
+		$this->assertEquals(2, count($result['included']));
54 54
 
55
-		$this->assertArrayNotHasKey( 'errors', $result );
55
+		$this->assertArrayNotHasKey('errors', $result);
56 56
 	}
57 57
 
58 58
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 		$params = array(
62 62
 			'filter' => array(
63
-				'=~' => array( 'customer.code' => 'UTC' )
63
+				'=~' => array('customer.code' => 'UTC')
64 64
 			),
65 65
 			'fields' => array(
66 66
 				'customer' => 'customer.id,customer.label'
@@ -68,23 +68,23 @@  discard block
 block discarded – undo
68 68
 			'sort' => 'customer.id',
69 69
 			'include' => 'customer/address'
70 70
 		);
71
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
72
-		$this->view->addHelper( 'param', $helper );
71
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
72
+		$this->view->addHelper('param', $helper);
73 73
 
74
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
75
-		$result = json_decode( (string) $response->getBody(), true );
74
+		$response = $this->object->get($this->view->request(), $this->view->response());
75
+		$result = json_decode((string) $response->getBody(), true);
76 76
 
77 77
 
78
-		$this->assertEquals( 200, $response->getStatusCode() );
79
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
78
+		$this->assertEquals(200, $response->getStatusCode());
79
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
80 80
 
81
-		$this->assertEquals( 3, $result['meta']['total'] );
82
-		$this->assertEquals( 3, count( $result['data'] ) );
83
-		$this->assertEquals( 'customer', $result['data'][0]['type'] );
84
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
85
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['customer/address'] ) );
86
-		$this->assertEquals( 4, count( $result['included'] ) );
81
+		$this->assertEquals(3, $result['meta']['total']);
82
+		$this->assertEquals(3, count($result['data']));
83
+		$this->assertEquals('customer', $result['data'][0]['type']);
84
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
85
+		$this->assertEquals(1, count($result['data'][0]['relationships']['customer/address']));
86
+		$this->assertEquals(4, count($result['included']));
87 87
 
88
-		$this->assertArrayNotHasKey( 'errors', $result );
88
+		$this->assertArrayNotHasKey('errors', $result);
89 89
 	}
90 90
 }
91 91
\ No newline at end of file
Please login to merge, or discard this patch.