|
@@ -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\Product\Standard( $this->context, 'product' ); |
|
25
|
|
- $this->object->setAimeos( \TestHelperJadm::getAimeos() ); |
|
26
|
|
- $this->object->setView( $this->view ); |
|
|
24
|
+ $this->object = new \Aimeos\Admin\JsonAdm\Product\Standard($this->context, 'product'); |
|
|
25
|
+ $this->object->setAimeos(\TestHelperJadm::getAimeos()); |
|
|
26
|
+ $this->object->setView($this->view); |
|
27
|
27
|
} |
|
28
|
28
|
|
|
29
|
29
|
|
|
@@ -31,33 +31,33 @@ discard block |
|
|
block discarded – undo |
|
31
|
31
|
{ |
|
32
|
32
|
$params = array( |
|
33
|
33
|
'filter' => array( |
|
34
|
|
- '==' => array( 'product.code' => 'CNE' ) |
|
|
34
|
+ '==' => array('product.code' => 'CNE') |
|
35
|
35
|
), |
|
36
|
36
|
'include' => 'text,product,product/property' |
|
37
|
37
|
); |
|
38
|
|
- $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
39
|
|
- $this->view->addHelper( 'param', $helper ); |
|
40
|
|
- |
|
41
|
|
- $response = $this->object->get( $this->view->request(), $this->view->response() ); |
|
42
|
|
- $result = json_decode( (string) $response->getBody(), true ); |
|
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( 7, 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( 15, 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 ); |
|
|
38
|
+ $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
|
39
|
+ $this->view->addHelper('param', $helper); |
|
|
40
|
+ |
|
|
41
|
+ $response = $this->object->get($this->view->request(), $this->view->response()); |
|
|
42
|
+ $result = json_decode((string) $response->getBody(), true); |
|
|
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(7, 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(15, 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,22 +70,22 @@ discard block |
|
|
block discarded – undo |
|
70
|
70
|
'sort' => 'product.label', |
|
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
|
|
- $this->assertEquals( 200, $response->getStatusCode() ); |
|
80
|
|
- $this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) ); |
|
|
79
|
+ $this->assertEquals(200, $response->getStatusCode()); |
|
|
80
|
+ $this->assertEquals(1, count($response->getHeader('Content-Type'))); |
|
81
|
81
|
|
|
82
|
|
- $this->assertEquals( 28, $result['meta']['total'] ); |
|
83
|
|
- $this->assertEquals( 25, count( $result['data'] ) ); |
|
84
|
|
- $this->assertEquals( 'product', $result['data'][5]['type'] ); |
|
85
|
|
- $this->assertEquals( 3, count( $result['data'][5]['attributes'] ) ); |
|
86
|
|
- $this->assertEquals( 4, count( $result['data'][5]['relationships']['product/property'] ) ); |
|
87
|
|
- $this->assertGreaterThanOrEqual( 20, count( $result['included'] ) ); |
|
|
82
|
+ $this->assertEquals(28, $result['meta']['total']); |
|
|
83
|
+ $this->assertEquals(25, count($result['data'])); |
|
|
84
|
+ $this->assertEquals('product', $result['data'][5]['type']); |
|
|
85
|
+ $this->assertEquals(3, count($result['data'][5]['attributes'])); |
|
|
86
|
+ $this->assertEquals(4, count($result['data'][5]['relationships']['product/property'])); |
|
|
87
|
+ $this->assertGreaterThanOrEqual(20, count($result['included'])); |
|
88
|
88
|
|
|
89
|
|
- $this->assertArrayNotHasKey( 'errors', $result ); |
|
|
89
|
+ $this->assertArrayNotHasKey('errors', $result); |
|
90
|
90
|
} |
|
91
|
91
|
} |
|
92
|
92
|
\ No newline at end of file |