Completed
Push — master ( 4533c7...c7f940 )
by Aimeos
02:24
created
admin/jsonadm/tests/Admin/JsonAdm/Product/StandardTest.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Product\Standard( $this->context, $this->view, $templatePaths, 'product' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Product\Standard($this->context, $this->view, $templatePaths, 'product');
26 26
 	}
27 27
 
28 28
 
@@ -30,34 +30,34 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'product.code' => 'CNE' )
33
+				'==' => array('product.code' => 'CNE')
34 34
 			),
35 35
 			'include' => 'text,product,product/property'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
39
-
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
42
-
43
-
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
46
-
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
50
-		$this->assertEquals( 6, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertArrayHaskey( 'self', $result['data'][0]['relationships']['text'][0]['data']['links'] );
52
-		$this->assertEquals( 5, count( $result['data'][0]['relationships']['product'] ) );
53
-		$this->assertArrayHaskey( 'self', $result['data'][0]['relationships']['product'][0]['data']['links'] );
54
-		$this->assertEquals( 4, count( $result['data'][0]['relationships']['product/property'] ) );
55
-		$this->assertEquals( 14, count( $result['included'] ) );
56
-		$this->assertEquals( 'product/property', $result['included'][0]['type'] );
57
-		$this->assertArrayHaskey( 'self', $result['included'][0]['links'] );
58
-		$this->assertArrayHaskey( 'related', $result['included'][0]['links'] );
59
-
60
-		$this->assertArrayNotHasKey( 'errors', $result );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39
+
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42
+
43
+
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46
+
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('product', $result['data'][0]['type']);
50
+		$this->assertEquals(6, count($result['data'][0]['relationships']['text']));
51
+		$this->assertArrayHaskey('self', $result['data'][0]['relationships']['text'][0]['data']['links']);
52
+		$this->assertEquals(5, count($result['data'][0]['relationships']['product']));
53
+		$this->assertArrayHaskey('self', $result['data'][0]['relationships']['product'][0]['data']['links']);
54
+		$this->assertEquals(4, count($result['data'][0]['relationships']['product/property']));
55
+		$this->assertEquals(14, count($result['included']));
56
+		$this->assertEquals('product/property', $result['included'][0]['type']);
57
+		$this->assertArrayHaskey('self', $result['included'][0]['links']);
58
+		$this->assertArrayHaskey('related', $result['included'][0]['links']);
59
+
60
+		$this->assertArrayNotHasKey('errors', $result);
61 61
 	}
62 62
 
63 63
 
@@ -70,23 +70,23 @@  discard block
 block discarded – undo
70 70
 			'sort' => 'product.id',
71 71
 			'include' => 'product,product/property'
72 72
 		);
73
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
74
-		$this->view->addHelper( 'param', $helper );
73
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
74
+		$this->view->addHelper('param', $helper);
75 75
 
76
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
77
-		$result = json_decode( (string) $response->getBody(), true );
76
+		$response = $this->object->get($this->view->request(), $this->view->response());
77
+		$result = json_decode((string) $response->getBody(), true);
78 78
 
79 79
 
80
-		$this->assertEquals( 200, $response->getStatusCode() );
81
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
80
+		$this->assertEquals(200, $response->getStatusCode());
81
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
82 82
 
83
-		$this->assertEquals( 28, $result['meta']['total'] );
84
-		$this->assertEquals( 25, count( $result['data'] ) );
85
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
86
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
87
-		$this->assertEquals( 5, count( $result['data'][0]['relationships']['product'] ) );
88
-		$this->assertEquals( 21, count( $result['included'] ) );
83
+		$this->assertEquals(28, $result['meta']['total']);
84
+		$this->assertEquals(25, count($result['data']));
85
+		$this->assertEquals('product', $result['data'][0]['type']);
86
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
87
+		$this->assertEquals(5, count($result['data'][0]['relationships']['product']));
88
+		$this->assertEquals(21, count($result['included']));
89 89
 
90
-		$this->assertArrayNotHasKey( 'errors', $result );
90
+		$this->assertArrayNotHasKey('errors', $result);
91 91
 	}
92 92
 }
93 93
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Coupon/StandardTest.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Coupon\Standard( $this->context, $this->view, $templatePaths, 'coupon' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Coupon\Standard($this->context, $this->view, $templatePaths, 'coupon');
26 26
 	}
27 27
 
28 28
 
@@ -30,27 +30,27 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'coupon.code.code' => '90AB' )
33
+				'==' => array('coupon.code.code' => '90AB')
34 34
 			),
35 35
 			'include' => 'coupon/code'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'coupon', $result['data'][0]['type'] );
50
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['coupon/code'] ) );
51
-		$this->assertEquals( 1, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('coupon', $result['data'][0]['type']);
50
+		$this->assertEquals(1, count($result['data'][0]['relationships']['coupon/code']));
51
+		$this->assertEquals(1, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 
56 56
 
@@ -63,22 +63,22 @@  discard block
 block discarded – undo
63 63
 			'sort' => 'coupon.id',
64 64
 			'include' => 'coupon/code'
65 65
 		);
66
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
67
-		$this->view->addHelper( 'param', $helper );
66
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
67
+		$this->view->addHelper('param', $helper);
68 68
 
69
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
70
-		$result = json_decode( (string) $response->getBody(), true );
69
+		$response = $this->object->get($this->view->request(), $this->view->response());
70
+		$result = json_decode((string) $response->getBody(), true);
71 71
 
72 72
 
73
-		$this->assertEquals( 200, $response->getStatusCode() );
74
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
73
+		$this->assertEquals(200, $response->getStatusCode());
74
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
75 75
 
76
-		$this->assertEquals( 5, $result['meta']['total'] );
77
-		$this->assertEquals( 5, count( $result['data'] ) );
78
-		$this->assertEquals( 'coupon', $result['data'][0]['type'] );
79
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
80
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['coupon/code'] ) );
81
-		$this->assertEquals( 5, count( $result['included'] ) );
82
-		$this->assertArrayNotHasKey( 'errors', $result );
76
+		$this->assertEquals(5, $result['meta']['total']);
77
+		$this->assertEquals(5, count($result['data']));
78
+		$this->assertEquals('coupon', $result['data'][0]['type']);
79
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
80
+		$this->assertEquals(1, count($result['data'][0]['relationships']['coupon/code']));
81
+		$this->assertEquals(5, count($result['included']));
82
+		$this->assertArrayNotHasKey('errors', $result);
83 83
 	}
84 84
 }
85 85
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Customer/StandardTest.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Customer\Standard( $this->context, $this->view, $templatePaths, 'customer' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Customer\Standard($this->context, $this->view, $templatePaths, 'customer');
26 26
 	}
27 27
 
28 28
 
@@ -30,28 +30,28 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'customer.code' => 'UTC001' )
33
+				'==' => array('customer.code' => 'UTC001')
34 34
 			),
35 35
 			'include' => 'text,customer/address'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'customer', $result['data'][0]['type'] );
50
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['customer/address'] ) );
52
-		$this->assertEquals( 2, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('customer', $result['data'][0]['type']);
50
+		$this->assertEquals(1, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(1, count($result['data'][0]['relationships']['customer/address']));
52
+		$this->assertEquals(2, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 
57 57
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	{
60 60
 		$params = array(
61 61
 			'filter' => array(
62
-				'=~' => array( 'customer.code' => 'UTC' )
62
+				'=~' => array('customer.code' => 'UTC')
63 63
 			),
64 64
 			'fields' => array(
65 65
 				'customer' => 'customer.id,customer.label'
@@ -67,23 +67,23 @@  discard block
 block discarded – undo
67 67
 			'sort' => 'customer.id',
68 68
 			'include' => 'customer/address'
69 69
 		);
70
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
71
-		$this->view->addHelper( 'param', $helper );
70
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
71
+		$this->view->addHelper('param', $helper);
72 72
 
73
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
74
-		$result = json_decode( (string) $response->getBody(), true );
73
+		$response = $this->object->get($this->view->request(), $this->view->response());
74
+		$result = json_decode((string) $response->getBody(), true);
75 75
 
76 76
 
77
-		$this->assertEquals( 200, $response->getStatusCode() );
78
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
77
+		$this->assertEquals(200, $response->getStatusCode());
78
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
79 79
 
80
-		$this->assertEquals( 3, $result['meta']['total'] );
81
-		$this->assertEquals( 3, count( $result['data'] ) );
82
-		$this->assertEquals( 'customer', $result['data'][0]['type'] );
83
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
84
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['customer/address'] ) );
85
-		$this->assertEquals( 4, count( $result['included'] ) );
80
+		$this->assertEquals(3, $result['meta']['total']);
81
+		$this->assertEquals(3, count($result['data']));
82
+		$this->assertEquals('customer', $result['data'][0]['type']);
83
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
84
+		$this->assertEquals(1, count($result['data'][0]['relationships']['customer/address']));
85
+		$this->assertEquals(4, count($result['included']));
86 86
 
87
-		$this->assertArrayNotHasKey( 'errors', $result );
87
+		$this->assertArrayNotHasKey('errors', $result);
88 88
 	}
89 89
 }
90 90
\ 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   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Text\Standard( $this->context, $this->view, $templatePaths, 'text' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Text\Standard($this->context, $this->view, $templatePaths, 'text');
26 26
 	}
27 27
 
28 28
 
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'text.label' => 'misc_long_desc' )
33
+				'==' => array('text.label' => 'misc_long_desc')
34 34
 			),
35 35
 			'include' => 'media'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'text', $result['data'][0]['type'] );
50
-		$this->assertEquals( 4, count( $result['data'][0]['relationships']['media'] ) );
51
-		$this->assertEquals( 4, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('text', $result['data'][0]['type']);
50
+		$this->assertEquals(4, count($result['data'][0]['relationships']['media']));
51
+		$this->assertEquals(4, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Price/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Media\Standard( $this->context, $this->view, $templatePaths, 'price' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Media\Standard($this->context, $this->view, $templatePaths, 'price');
26 26
 	}
27 27
 
28 28
 
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'price.value' => '12.95' )
33
+				'==' => array('price.value' => '12.95')
34 34
 			),
35 35
 			'include' => 'attribute'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 2, $result['meta']['total'] );
48
-		$this->assertEquals( 2, count( $result['data'] ) );
49
-		$this->assertEquals( 'price', $result['data'][0]['type'] );
50
-		$this->assertEquals( 0, count( $result['data'][0]['relationships'] ) );
51
-		$this->assertEquals( 0, count( $result['included'] ) );
47
+		$this->assertEquals(2, $result['meta']['total']);
48
+		$this->assertEquals(2, count($result['data']));
49
+		$this->assertEquals('price', $result['data'][0]['type']);
50
+		$this->assertEquals(0, count($result['data'][0]['relationships']));
51
+		$this->assertEquals(0, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/TestHelperJadm.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 	public static function bootstrap()
16 16
 	{
17 17
 		self::getAimeos();
18
-		\Aimeos\MShop\Factory::setCache( false );
19
-		\Aimeos\Admin\JsonAdm\Factory::setCache( false );
18
+		\Aimeos\MShop\Factory::setCache(false);
19
+		\Aimeos\Admin\JsonAdm\Factory::setCache(false);
20 20
 	}
21 21
 
22 22
 
23
-	public static function getContext( $site = 'unittest' )
23
+	public static function getContext($site = 'unittest')
24 24
 	{
25
-		if( !isset( self::$context[$site] ) ) {
26
-			self::$context[$site] = self::createContext( $site );
25
+		if (!isset(self::$context[$site])) {
26
+			self::$context[$site] = self::createContext($site);
27 27
 		}
28 28
 
29 29
 		return clone self::$context[$site];
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public static function getAimeos()
34 34
 	{
35
-		if( !isset( self::$aimeos ) )
35
+		if (!isset(self::$aimeos))
36 36
 		{
37 37
 			require_once 'Bootstrap.php';
38
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
38
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
39 39
 
40
-			$extdir = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
41
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
40
+			$extdir = dirname(dirname(dirname(dirname(__FILE__))));
41
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
42 42
 		}
43 43
 
44 44
 		return self::$aimeos;
@@ -47,85 +47,85 @@  discard block
 block discarded – undo
47 47
 
48 48
 	public static function getJsonadmPaths()
49 49
 	{
50
-		return self::getAimeos()->getCustomPaths( 'admin/jsonadm/templates' );
50
+		return self::getAimeos()->getCustomPaths('admin/jsonadm/templates');
51 51
 	}
52 52
 
53 53
 
54
-	private static function createContext( $site )
54
+	private static function createContext($site)
55 55
 	{
56 56
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
57 57
 		$aimeos = self::getAimeos();
58 58
 
59 59
 
60
-		$paths = $aimeos->getConfigPaths( 'mysql' );
60
+		$paths = $aimeos->getConfigPaths('mysql');
61 61
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
62 62
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
63 63
 
64
-		$conf = new \Aimeos\MW\Config\PHPArray( array(), $paths );
65
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
66
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
67
-		$ctx->setConfig( $conf );
64
+		$conf = new \Aimeos\MW\Config\PHPArray(array(), $paths);
65
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
66
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
67
+		$ctx->setConfig($conf);
68 68
 
69 69
 
70
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
71
-		$ctx->setDatabaseManager( $dbm );
70
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
71
+		$ctx->setDatabaseManager($dbm);
72 72
 
73 73
 
74
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
75
-		$ctx->setLogger( $logger );
74
+		$logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
75
+		$ctx->setLogger($logger);
76 76
 
77 77
 
78 78
 		$session = new \Aimeos\MW\Session\None();
79
-		$ctx->setSession( $session );
79
+		$ctx->setSession($session);
80 80
 
81 81
 
82
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
83
-		$ctx->setI18n( array( 'de' => $i18n ) );
82
+		$i18n = new \Aimeos\MW\Translation\None('de');
83
+		$ctx->setI18n(array('de' => $i18n));
84 84
 
85 85
 
86
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
87
-		$locale = $localeManager->bootstrap( $site, 'de', '', false );
88
-		$ctx->setLocale( $locale );
86
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
87
+		$locale = $localeManager->bootstrap($site, 'de', '', false);
88
+		$ctx->setLocale($locale);
89 89
 
90 90
 
91
-		$view = self::createView( $conf );
92
-		$ctx->setView( $view );
91
+		$view = self::createView($conf);
92
+		$ctx->setView($view);
93 93
 
94 94
 
95
-		$ctx->setEditor( 'core:admin/jsonadm' );
95
+		$ctx->setEditor('core:admin/jsonadm');
96 96
 
97 97
 		return $ctx;
98 98
 	}
99 99
 
100 100
 
101
-	protected static function createView( \Aimeos\MW\Config\Iface $config )
101
+	protected static function createView(\Aimeos\MW\Config\Iface $config)
102 102
 	{
103
-		$tmplpaths = self::getAimeos()->getCustomPaths( 'admin/jsonadm/templates' );
103
+		$tmplpaths = self::getAimeos()->getCustomPaths('admin/jsonadm/templates');
104 104
 
105
-		$view = new \Aimeos\MW\View\Standard( $tmplpaths );
105
+		$view = new \Aimeos\MW\View\Standard($tmplpaths);
106 106
 
107
-		$trans = new \Aimeos\MW\Translation\None( 'de_DE' );
108
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans );
109
-		$view->addHelper( 'translate', $helper );
107
+		$trans = new \Aimeos\MW\Translation\None('de_DE');
108
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans);
109
+		$view->addHelper('translate', $helper);
110 110
 
111
-		$helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' );
112
-		$view->addHelper( 'url', $helper );
111
+		$helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl');
112
+		$view->addHelper('url', $helper);
113 113
 
114
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' );
115
-		$view->addHelper( 'number', $helper );
114
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', '');
115
+		$view->addHelper('number', $helper);
116 116
 
117
-		$helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' );
118
-		$view->addHelper( 'date', $helper );
117
+		$helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d');
118
+		$view->addHelper('date', $helper);
119 119
 
120
-		$config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'admin/jsonadm' ) );
121
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
122
-		$view->addHelper( 'config', $helper );
120
+		$config = new \Aimeos\MW\Config\Decorator\Protect($config, array('admin/jsonadm'));
121
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
122
+		$view->addHelper('config', $helper);
123 123
 
124
-		$helper = new \Aimeos\MW\View\Helper\Request\Standard( $view, new \Zend\Diactoros\ServerRequest() );
125
-		$view->addHelper( 'request', $helper );
124
+		$helper = new \Aimeos\MW\View\Helper\Request\Standard($view, new \Zend\Diactoros\ServerRequest());
125
+		$view->addHelper('request', $helper);
126 126
 
127
-		$helper = new \Aimeos\MW\View\Helper\Response\Standard( $view, new \Zend\Diactoros\Response() );
128
-		$view->addHelper( 'response', $helper );
127
+		$helper = new \Aimeos\MW\View\Helper\Response\Standard($view, new \Zend\Diactoros\Response());
128
+		$view->addHelper('response', $helper);
129 129
 
130 130
 		return $view;
131 131
 	}
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Catalog/Standard.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
111 111
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
112 112
 	 */
113
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
113
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
114 114
 	{
115 115
 		/** admin/jsonadm/partials/catalog/template-data
116 116
 		 * Relative path to the data partial template file for the catalog client
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 		 * @since 2016.07
128 128
 		 * @category Developer
129 129
 		 */
130
-		$this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/catalog/template-data' ) );
130
+		$this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/catalog/template-data'));
131 131
 
132
-		return parent::get( $request, $response );
132
+		return parent::get($request, $response);
133 133
 	}
134 134
 
135 135
 
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 	 * @param array $include List of resource types that should be fetched
141 141
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
142 142
 	 */
143
-	protected function getChildItems( array $items, array $include )
143
+	protected function getChildItems(array $items, array $include)
144 144
 	{
145 145
 		$list = array();
146 146
 
147
-		if( in_array( 'catalog', $include ) )
147
+		if (in_array('catalog', $include))
148 148
 		{
149
-			foreach( $items as $item ) {
150
-				$list = array_merge( $list, $item->getChildren() );
149
+			foreach ($items as $item) {
150
+				$list = array_merge($list, $item->getChildren());
151 151
 			}
152 152
 		}
153 153
 
@@ -162,35 +162,35 @@  discard block
 block discarded – undo
162 162
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
163 163
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
164 164
 	 */
165
-	protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
165
+	protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response)
166 166
 	{
167
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' );
167
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog');
168 168
 
169
-		if( ( $key = $view->param( 'aggregate' ) ) !== null )
169
+		if (($key = $view->param('aggregate')) !== null)
170 170
 		{
171
-			$search = $this->initCriteria( $manager->createSearch(), $view->param() );
172
-			$view->data = $manager->aggregate( $search, $key );
171
+			$search = $this->initCriteria($manager->createSearch(), $view->param());
172
+			$view->data = $manager->aggregate($search, $key);
173 173
 			return $response;
174 174
 		}
175 175
 
176
-		$include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : array() );
177
-		$search = $this->initCriteria( $manager->createSearch(), $view->param() );
176
+		$include = (($include = $view->param('include')) !== null ? explode(',', $include) : array());
177
+		$search = $this->initCriteria($manager->createSearch(), $view->param());
178 178
 		$total = 1;
179 179
 
180
-		if( ( $id = $view->param( 'id' ) ) == null )
180
+		if (($id = $view->param('id')) == null)
181 181
 		{
182
-			$view->data = $manager->searchItems( $search, array(), $total );
183
-			$view->listItems = $this->getListItems( $view->data, $include );
184
-			$view->childItems = $this->getChildItems( $view->data, $include );
182
+			$view->data = $manager->searchItems($search, array(), $total);
183
+			$view->listItems = $this->getListItems($view->data, $include);
184
+			$view->childItems = $this->getChildItems($view->data, $include);
185 185
 		}
186 186
 		else
187 187
 		{
188
-			$view->data = $manager->getTree( $id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search );
189
-			$view->listItems = $this->getListItems( array( $id => $view->data ), $include );
190
-			$view->childItems = $this->getChildItems( array( $view->data ), $include );
188
+			$view->data = $manager->getTree($id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search);
189
+			$view->listItems = $this->getListItems(array($id => $view->data), $include);
190
+			$view->childItems = $this->getChildItems(array($view->data), $include);
191 191
 		}
192 192
 
193
-		$view->refItems = $this->getRefItems( $view->listItems );
193
+		$view->refItems = $this->getRefItems($view->listItems);
194 194
 		$view->total = $total;
195 195
 
196 196
 		return $response;
@@ -204,18 +204,18 @@  discard block
 block discarded – undo
204 204
 	 * @param array $include List of resource types that should be fetched
205 205
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
206 206
 	 */
207
-	protected function getListItems( array $items, array $include )
207
+	protected function getListItems(array $items, array $include)
208 208
 	{
209
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' );
209
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists');
210 210
 
211 211
 		$search = $manager->createSearch();
212 212
 		$expr = array(
213
-			$search->compare( '==', 'catalog.lists.parentid', array_keys( $items ) ),
214
-			$search->compare( '==', 'catalog.lists.domain', $include ),
213
+			$search->compare('==', 'catalog.lists.parentid', array_keys($items)),
214
+			$search->compare('==', 'catalog.lists.domain', $include),
215 215
 		);
216
-		$search->setConditions( $search->combine( '&&', $expr ) );
216
+		$search->setConditions($search->combine('&&', $expr));
217 217
 
218
-		return $manager->searchItems( $search );
218
+		return $manager->searchItems($search);
219 219
 	}
220 220
 
221 221
 
@@ -226,32 +226,32 @@  discard block
 block discarded – undo
226 226
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
227 227
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
228 228
 	 */
229
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
229
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
230 230
 	{
231
-		$targetId = ( isset( $entry->targetid ) ? $entry->targetid : null );
232
-		$refId = ( isset( $entry->refid ) ? $entry->refid : null );
231
+		$targetId = (isset($entry->targetid) ? $entry->targetid : null);
232
+		$refId = (isset($entry->refid) ? $entry->refid : null);
233 233
 
234
-		if( isset( $entry->id ) )
234
+		if (isset($entry->id))
235 235
 		{
236
-			$item = $manager->getItem( $entry->id );
237
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
238
-			$manager->saveItem( $item );
236
+			$item = $manager->getItem($entry->id);
237
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
238
+			$manager->saveItem($item);
239 239
 
240
-			if( isset( $entry->parentid ) && $targetId !== null ) {
241
-				$manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId );
240
+			if (isset($entry->parentid) && $targetId !== null) {
241
+				$manager->moveItem($item->getId(), $entry->parentid, $targetId, $refId);
242 242
 			}
243 243
 		}
244 244
 		else
245 245
 		{
246 246
 			$item = $manager->createItem();
247
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
248
-			$manager->insertItem( $item, $targetId, $refId );
247
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
248
+			$manager->insertItem($item, $targetId, $refId);
249 249
 		}
250 250
 
251
-		if( isset( $entry->relationships ) ) {
252
-			$this->saveRelationships( $manager, $item, $entry->relationships );
251
+		if (isset($entry->relationships)) {
252
+			$this->saveRelationships($manager, $item, $entry->relationships);
253 253
 		}
254 254
 
255
-		return $manager->getItem( $item->getId() );
255
+		return $manager->getItem($item->getId());
256 256
 	}
257 257
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Order/Base/Standard.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
111 111
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
112 112
 	 */
113
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
113
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
114 114
 	{
115 115
 		/** admin/jsonadm/partials/order/base/template-data
116 116
 		 * Relative path to the data partial template file for the order base client
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 		 * @since 2016.01
128 128
 		 * @category Developer
129 129
 		 */
130
-		$this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/base/template-data' ) );
130
+		$this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/base/template-data'));
131 131
 
132
-		return parent::get( $request, $response );
132
+		return parent::get($request, $response);
133 133
 	}
134 134
 
135 135
 
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 	 * @param array $include List of resource types that should be fetched
141 141
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
142 142
 	 */
143
-	protected function getChildItems( array $items, array $include )
143
+	protected function getChildItems(array $items, array $include)
144 144
 	{
145 145
 		$list = array();
146
-		$ids = array_keys( $items );
147
-		$keys = array( 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service' );
148
-		$include = array_intersect( $include, $keys );
146
+		$ids = array_keys($items);
147
+		$keys = array('order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service');
148
+		$include = array_intersect($include, $keys);
149 149
 
150
-		foreach( $include as $type )
150
+		foreach ($include as $type)
151 151
 		{
152
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type );
152
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type);
153 153
 
154 154
 			$search = $manager->createSearch();
155
-			$search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.baseid', $ids ) );
155
+			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.baseid', $ids));
156 156
 
157
-			$list = array_merge( $list, $manager->searchItems( $search ) );
157
+			$list = array_merge($list, $manager->searchItems($search));
158 158
 		}
159 159
 
160 160
 		return $list;
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Order/Standard.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
112 112
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
113 113
 	 */
114
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
114
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
115 115
 	{
116 116
 		/** admin/jsonadm/partials/order/template-data
117 117
 		 * Relative path to the data partial template file for the order client
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 		 * @since 2016.01
129 129
 		 * @category Developer
130 130
 		 */
131
-		$this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/template-data' ) );
131
+		$this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/template-data'));
132 132
 
133
-		return parent::get( $request, $response );
133
+		return parent::get($request, $response);
134 134
 	}
135 135
 
136 136
 
@@ -141,35 +141,35 @@  discard block
 block discarded – undo
141 141
 	 * @param array $include List of resource types that should be fetched
142 142
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
143 143
 	 */
144
-	protected function getChildItems( array $items, array $include )
144
+	protected function getChildItems(array $items, array $include)
145 145
 	{
146 146
 		$list = array();
147 147
 
148
-		if( in_array( 'order/base', $include ) )
148
+		if (in_array('order/base', $include))
149 149
 		{
150 150
 			$ids = array();
151 151
 
152
-			foreach( $items as $item ) {
152
+			foreach ($items as $item) {
153 153
 				$ids[] = $item->getBaseId();
154 154
 			}
155 155
 
156
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' );
156
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base');
157 157
 
158 158
 			$search = $manager->createSearch();
159
-			$search->setConditions( $search->compare( '==', 'order.base.id', $ids ) );
159
+			$search->setConditions($search->compare('==', 'order.base.id', $ids));
160 160
 
161
-			$list = array_merge( $list, $manager->searchItems( $search ) );
161
+			$list = array_merge($list, $manager->searchItems($search));
162 162
 		}
163 163
 
164
-		if( in_array( 'order/status', $include ) )
164
+		if (in_array('order/status', $include))
165 165
 		{
166
-			$ids = array_keys( $items );
167
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/status' );
166
+			$ids = array_keys($items);
167
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/status');
168 168
 
169 169
 			$search = $manager->createSearch();
170
-			$search->setConditions( $search->compare( '==', 'order.status.parentid', $ids ) );
170
+			$search->setConditions($search->compare('==', 'order.status.parentid', $ids));
171 171
 
172
-			$list = array_merge( $list, $manager->searchItems( $search ) );
172
+			$list = array_merge($list, $manager->searchItems($search));
173 173
 		}
174 174
 
175 175
 		return $list;
Please login to merge, or discard this patch.