@@ -22,7 +22,7 @@ discard block |
||
| 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,29 +30,29 @@ discard block |
||
| 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,product/stock' |
| 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 | 40 | $header = array(); |
| 41 | 41 | $status = 500; |
| 42 | 42 | |
| 43 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 44 | - |
|
| 45 | - $this->assertEquals( 200, $status ); |
|
| 46 | - $this->assertEquals( 1, count( $header ) ); |
|
| 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->assertEquals( 5, count( $result['data'][0]['relationships']['product'] ) ); |
|
| 52 | - $this->assertEquals( 4, count( $result['data'][0]['relationships']['product/property'] ) ); |
|
| 53 | - $this->assertEquals( 1, count( $result['data'][0]['relationships']['product/stock'] ) ); |
|
| 54 | - $this->assertEquals( 15, count( $result['included'] ) ); |
|
| 55 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 43 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 44 | + |
|
| 45 | + $this->assertEquals(200, $status); |
|
| 46 | + $this->assertEquals(1, count($header)); |
|
| 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->assertEquals(5, count($result['data'][0]['relationships']['product'])); |
|
| 52 | + $this->assertEquals(4, count($result['data'][0]['relationships']['product/property'])); |
|
| 53 | + $this->assertEquals(1, count($result['data'][0]['relationships']['product/stock'])); |
|
| 54 | + $this->assertEquals(15, count($result['included'])); |
|
| 55 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -65,22 +65,22 @@ discard block |
||
| 65 | 65 | 'sort' => 'product.id', |
| 66 | 66 | 'include' => 'product,product/stock' |
| 67 | 67 | ); |
| 68 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
| 69 | - $this->view->addHelper( 'param', $helper ); |
|
| 68 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
| 69 | + $this->view->addHelper('param', $helper); |
|
| 70 | 70 | |
| 71 | 71 | $header = array(); |
| 72 | 72 | $status = 500; |
| 73 | 73 | |
| 74 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 75 | - |
|
| 76 | - $this->assertEquals( 200, $status ); |
|
| 77 | - $this->assertEquals( 1, count( $header ) ); |
|
| 78 | - $this->assertEquals( 28, $result['meta']['total'] ); |
|
| 79 | - $this->assertEquals( 25, count( $result['data'] ) ); |
|
| 80 | - $this->assertEquals( 'product', $result['data'][0]['type'] ); |
|
| 81 | - $this->assertEquals( 2, count( $result['data'][0]['attributes'] ) ); |
|
| 82 | - $this->assertEquals( 5, count( $result['data'][0]['relationships']['product'] ) ); |
|
| 83 | - $this->assertEquals( 27, count( $result['included'] ) ); |
|
| 84 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 74 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 75 | + |
|
| 76 | + $this->assertEquals(200, $status); |
|
| 77 | + $this->assertEquals(1, count($header)); |
|
| 78 | + $this->assertEquals(28, $result['meta']['total']); |
|
| 79 | + $this->assertEquals(25, count($result['data'])); |
|
| 80 | + $this->assertEquals('product', $result['data'][0]['type']); |
|
| 81 | + $this->assertEquals(2, count($result['data'][0]['attributes'])); |
|
| 82 | + $this->assertEquals(5, count($result['data'][0]['relationships']['product'])); |
|
| 83 | + $this->assertEquals(27, count($result['included'])); |
|
| 84 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | \ No newline at end of file |
@@ -22,70 +22,70 @@ discard block |
||
| 22 | 22 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 23 | 23 | $this->view = $this->context->getView(); |
| 24 | 24 | |
| 25 | - $this->object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'product' ); |
|
| 25 | + $this->object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'product'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | public function testDelete() |
| 30 | 30 | { |
| 31 | 31 | $name = 'ClientJsonAdmStandard'; |
| 32 | - $this->context->getConfig()->set( 'mshop/product/manager/name', $name ); |
|
| 32 | + $this->context->getConfig()->set('mshop/product/manager/name', $name); |
|
| 33 | 33 | |
| 34 | - $productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' ) |
|
| 35 | - ->setMethods( array( 'deleteItem' ) ) |
|
| 36 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 34 | + $productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard') |
|
| 35 | + ->setMethods(array('deleteItem')) |
|
| 36 | + ->setConstructorArgs(array($this->context)) |
|
| 37 | 37 | ->getMock(); |
| 38 | 38 | |
| 39 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub ); |
|
| 39 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub); |
|
| 40 | 40 | |
| 41 | - $productManagerStub->expects( $this->once() )->method( 'deleteItem' ); |
|
| 41 | + $productManagerStub->expects($this->once())->method('deleteItem'); |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | - $params = array( 'id' => $this->getProductItem()->getId() ); |
|
| 45 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
| 46 | - $this->view->addHelper( 'param', $helper ); |
|
| 44 | + $params = array('id' => $this->getProductItem()->getId()); |
|
| 45 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
| 46 | + $this->view->addHelper('param', $helper); |
|
| 47 | 47 | |
| 48 | 48 | $header = array(); |
| 49 | 49 | $status = 500; |
| 50 | 50 | |
| 51 | - $result = json_decode( $this->object->delete( '', $header, $status ), true ); |
|
| 51 | + $result = json_decode($this->object->delete('', $header, $status), true); |
|
| 52 | 52 | |
| 53 | - $this->assertEquals( 200, $status ); |
|
| 54 | - $this->assertEquals( 1, count( $header ) ); |
|
| 55 | - $this->assertEquals( 1, $result['meta']['total'] ); |
|
| 56 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
| 57 | - $this->assertArrayNotHasKey( 'data', $result ); |
|
| 58 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 53 | + $this->assertEquals(200, $status); |
|
| 54 | + $this->assertEquals(1, count($header)); |
|
| 55 | + $this->assertEquals(1, $result['meta']['total']); |
|
| 56 | + $this->assertArrayNotHasKey('included', $result); |
|
| 57 | + $this->assertArrayNotHasKey('data', $result); |
|
| 58 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testDeleteBulk() |
| 63 | 63 | { |
| 64 | 64 | $name = 'ClientJsonAdmStandard'; |
| 65 | - $this->context->getConfig()->set( 'mshop/product/manager/name', $name ); |
|
| 65 | + $this->context->getConfig()->set('mshop/product/manager/name', $name); |
|
| 66 | 66 | |
| 67 | - $productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' ) |
|
| 68 | - ->setMethods( array( 'deleteItems' ) ) |
|
| 69 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 67 | + $productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard') |
|
| 68 | + ->setMethods(array('deleteItems')) |
|
| 69 | + ->setConstructorArgs(array($this->context)) |
|
| 70 | 70 | ->getMock(); |
| 71 | 71 | |
| 72 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub ); |
|
| 72 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub); |
|
| 73 | 73 | |
| 74 | - $productManagerStub->expects( $this->once() )->method( 'deleteItems' ); |
|
| 74 | + $productManagerStub->expects($this->once())->method('deleteItems'); |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | $body = '{"data":[{"type": "product", "id": "-1"},{"type": "product", "id": "-2"}]}'; |
| 78 | 78 | $header = array(); |
| 79 | 79 | $status = 500; |
| 80 | 80 | |
| 81 | - $result = json_decode( $this->object->delete( $body, $header, $status ), true ); |
|
| 81 | + $result = json_decode($this->object->delete($body, $header, $status), true); |
|
| 82 | 82 | |
| 83 | - $this->assertEquals( 200, $status ); |
|
| 84 | - $this->assertEquals( 1, count( $header ) ); |
|
| 85 | - $this->assertEquals( 2, $result['meta']['total'] ); |
|
| 86 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
| 87 | - $this->assertArrayNotHasKey( 'data', $result ); |
|
| 88 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 83 | + $this->assertEquals(200, $status); |
|
| 84 | + $this->assertEquals(1, count($header)); |
|
| 85 | + $this->assertEquals(2, $result['meta']['total']); |
|
| 86 | + $this->assertArrayNotHasKey('included', $result); |
|
| 87 | + $this->assertArrayNotHasKey('data', $result); |
|
| 88 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | $header = array(); |
| 96 | 96 | $status = 500; |
| 97 | 97 | |
| 98 | - $result = json_decode( $this->object->delete( $body, $header, $status ), true ); |
|
| 98 | + $result = json_decode($this->object->delete($body, $header, $status), true); |
|
| 99 | 99 | |
| 100 | - $this->assertEquals( 400, $status ); |
|
| 101 | - $this->assertEquals( 1, count( $header ) ); |
|
| 102 | - $this->assertEquals( 0, $result['meta']['total'] ); |
|
| 103 | - $this->assertArrayHasKey( 'errors', $result ); |
|
| 104 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
| 105 | - $this->assertArrayNotHasKey( 'data', $result ); |
|
| 100 | + $this->assertEquals(400, $status); |
|
| 101 | + $this->assertEquals(1, count($header)); |
|
| 102 | + $this->assertEquals(0, $result['meta']['total']); |
|
| 103 | + $this->assertArrayHasKey('errors', $result); |
|
| 104 | + $this->assertArrayNotHasKey('included', $result); |
|
| 105 | + $this->assertArrayNotHasKey('data', $result); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -111,18 +111,18 @@ discard block |
||
| 111 | 111 | $header = array(); |
| 112 | 112 | $status = 500; |
| 113 | 113 | |
| 114 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 115 | - |
|
| 116 | - $this->assertEquals( 200, $status ); |
|
| 117 | - $this->assertEquals( 1, count( $header ) ); |
|
| 118 | - $this->assertEquals( 28, $result['meta']['total'] ); |
|
| 119 | - $this->assertEquals( 25, count( $result['data'] ) ); |
|
| 120 | - $this->assertEquals( 'product', $result['data'][0]['type'] ); |
|
| 121 | - $this->assertEquals( 0, count( $result['included'] ) ); |
|
| 122 | - $this->assertArrayHasKey( 'next', $result['links'] ); |
|
| 123 | - $this->assertArrayHasKey( 'last', $result['links'] ); |
|
| 124 | - $this->assertArrayHasKey( 'self', $result['links'] ); |
|
| 125 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 114 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 115 | + |
|
| 116 | + $this->assertEquals(200, $status); |
|
| 117 | + $this->assertEquals(1, count($header)); |
|
| 118 | + $this->assertEquals(28, $result['meta']['total']); |
|
| 119 | + $this->assertEquals(25, count($result['data'])); |
|
| 120 | + $this->assertEquals('product', $result['data'][0]['type']); |
|
| 121 | + $this->assertEquals(0, count($result['included'])); |
|
| 122 | + $this->assertArrayHasKey('next', $result['links']); |
|
| 123 | + $this->assertArrayHasKey('last', $result['links']); |
|
| 124 | + $this->assertArrayHasKey('self', $result['links']); |
|
| 125 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -132,17 +132,17 @@ discard block |
||
| 132 | 132 | $status = 500; |
| 133 | 133 | |
| 134 | 134 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 135 | - $object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'product/stock/warehouse' ); |
|
| 135 | + $object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'product/stock/warehouse'); |
|
| 136 | 136 | |
| 137 | - $result = json_decode( $object->get( '', $header, $status ), true ); |
|
| 137 | + $result = json_decode($object->get('', $header, $status), true); |
|
| 138 | 138 | |
| 139 | - $this->assertEquals( 200, $status ); |
|
| 140 | - $this->assertEquals( 1, count( $header ) ); |
|
| 141 | - $this->assertEquals( 6, $result['meta']['total'] ); |
|
| 142 | - $this->assertEquals( 6, count( $result['data'] ) ); |
|
| 143 | - $this->assertEquals( 'product/stock/warehouse', $result['data'][0]['type'] ); |
|
| 144 | - $this->assertEquals( 0, count( $result['included'] ) ); |
|
| 145 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 139 | + $this->assertEquals(200, $status); |
|
| 140 | + $this->assertEquals(1, count($header)); |
|
| 141 | + $this->assertEquals(6, $result['meta']['total']); |
|
| 142 | + $this->assertEquals(6, count($result['data'])); |
|
| 143 | + $this->assertEquals('product/stock/warehouse', $result['data'][0]['type']); |
|
| 144 | + $this->assertEquals(0, count($result['included'])); |
|
| 145 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
@@ -152,17 +152,17 @@ discard block |
||
| 152 | 152 | $status = 500; |
| 153 | 153 | |
| 154 | 154 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 155 | - $object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'invalid' ); |
|
| 155 | + $object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'invalid'); |
|
| 156 | 156 | |
| 157 | - $result = json_decode( $object->get( '', $header, $status ), true ); |
|
| 157 | + $result = json_decode($object->get('', $header, $status), true); |
|
| 158 | 158 | |
| 159 | - $this->assertEquals( 404, $status ); |
|
| 160 | - $this->assertEquals( 1, count( $header ) ); |
|
| 161 | - $this->assertEquals( 1, count( $result['errors'] ) ); |
|
| 162 | - $this->assertArrayHasKey( 'title', $result['errors'][0] ); |
|
| 163 | - $this->assertArrayHasKey( 'detail', $result['errors'][0] ); |
|
| 164 | - $this->assertArrayNotHasKey( 'data', $result ); |
|
| 165 | - $this->assertArrayNotHasKey( 'indluded', $result ); |
|
| 159 | + $this->assertEquals(404, $status); |
|
| 160 | + $this->assertEquals(1, count($header)); |
|
| 161 | + $this->assertEquals(1, count($result['errors'])); |
|
| 162 | + $this->assertArrayHasKey('title', $result['errors'][0]); |
|
| 163 | + $this->assertArrayHasKey('detail', $result['errors'][0]); |
|
| 164 | + $this->assertArrayNotHasKey('data', $result); |
|
| 165 | + $this->assertArrayNotHasKey('indluded', $result); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -170,24 +170,24 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | $params = array( |
| 172 | 172 | 'filter' => array( |
| 173 | - '==' => array( 'product.type.code' => 'select' ) |
|
| 173 | + '==' => array('product.type.code' => 'select') |
|
| 174 | 174 | ) |
| 175 | 175 | ); |
| 176 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
| 177 | - $this->view->addHelper( 'param', $helper ); |
|
| 176 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
| 177 | + $this->view->addHelper('param', $helper); |
|
| 178 | 178 | |
| 179 | 179 | $header = array(); |
| 180 | 180 | $status = 500; |
| 181 | 181 | |
| 182 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 182 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 183 | 183 | |
| 184 | - $this->assertEquals( 200, $status ); |
|
| 185 | - $this->assertEquals( 1, count( $header ) ); |
|
| 186 | - $this->assertEquals( 3, $result['meta']['total'] ); |
|
| 187 | - $this->assertEquals( 3, count( $result['data'] ) ); |
|
| 188 | - $this->assertEquals( 'product', $result['data'][0]['type'] ); |
|
| 189 | - $this->assertEquals( 0, count( $result['included'] ) ); |
|
| 190 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 184 | + $this->assertEquals(200, $status); |
|
| 185 | + $this->assertEquals(1, count($header)); |
|
| 186 | + $this->assertEquals(3, $result['meta']['total']); |
|
| 187 | + $this->assertEquals(3, count($result['data'])); |
|
| 188 | + $this->assertEquals('product', $result['data'][0]['type']); |
|
| 189 | + $this->assertEquals(0, count($result['included'])); |
|
| 190 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
@@ -196,26 +196,26 @@ discard block |
||
| 196 | 196 | $params = array( |
| 197 | 197 | 'filter' => array( |
| 198 | 198 | '&&' => array( |
| 199 | - array( '=~' => array( 'product.label' => 'Unittest: Test' ) ), |
|
| 200 | - array( '==' => array( 'product.type.code' => 'select' ) ), |
|
| 199 | + array('=~' => array('product.label' => 'Unittest: Test')), |
|
| 200 | + array('==' => array('product.type.code' => 'select')), |
|
| 201 | 201 | ) |
| 202 | 202 | ) |
| 203 | 203 | ); |
| 204 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
| 205 | - $this->view->addHelper( 'param', $helper ); |
|
| 204 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
| 205 | + $this->view->addHelper('param', $helper); |
|
| 206 | 206 | |
| 207 | 207 | $header = array(); |
| 208 | 208 | $status = 500; |
| 209 | 209 | |
| 210 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 210 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 211 | 211 | |
| 212 | - $this->assertEquals( 200, $status ); |
|
| 213 | - $this->assertEquals( 1, count( $header ) ); |
|
| 214 | - $this->assertEquals( 2, $result['meta']['total'] ); |
|
| 215 | - $this->assertEquals( 2, count( $result['data'] ) ); |
|
| 216 | - $this->assertEquals( 'product', $result['data'][0]['type'] ); |
|
| 217 | - $this->assertEquals( 0, count( $result['included'] ) ); |
|
| 218 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 212 | + $this->assertEquals(200, $status); |
|
| 213 | + $this->assertEquals(1, count($header)); |
|
| 214 | + $this->assertEquals(2, $result['meta']['total']); |
|
| 215 | + $this->assertEquals(2, count($result['data'])); |
|
| 216 | + $this->assertEquals('product', $result['data'][0]['type']); |
|
| 217 | + $this->assertEquals(0, count($result['included'])); |
|
| 218 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | |
@@ -227,24 +227,24 @@ discard block |
||
| 227 | 227 | 'limit' => 25 |
| 228 | 228 | ) |
| 229 | 229 | ); |
| 230 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
| 231 | - $this->view->addHelper( 'param', $helper ); |
|
| 230 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
| 231 | + $this->view->addHelper('param', $helper); |
|
| 232 | 232 | |
| 233 | 233 | $header = array(); |
| 234 | 234 | $status = 500; |
| 235 | 235 | |
| 236 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 237 | - |
|
| 238 | - $this->assertEquals( 200, $status ); |
|
| 239 | - $this->assertEquals( 1, count( $header ) ); |
|
| 240 | - $this->assertEquals( 28, $result['meta']['total'] ); |
|
| 241 | - $this->assertEquals( 3, count( $result['data'] ) ); |
|
| 242 | - $this->assertEquals( 'product', $result['data'][0]['type'] ); |
|
| 243 | - $this->assertEquals( 0, count( $result['included'] ) ); |
|
| 244 | - $this->assertArrayHasKey( 'first', $result['links'] ); |
|
| 245 | - $this->assertArrayHasKey( 'prev', $result['links'] ); |
|
| 246 | - $this->assertArrayHasKey( 'self', $result['links'] ); |
|
| 247 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 236 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 237 | + |
|
| 238 | + $this->assertEquals(200, $status); |
|
| 239 | + $this->assertEquals(1, count($header)); |
|
| 240 | + $this->assertEquals(28, $result['meta']['total']); |
|
| 241 | + $this->assertEquals(3, count($result['data'])); |
|
| 242 | + $this->assertEquals('product', $result['data'][0]['type']); |
|
| 243 | + $this->assertEquals(0, count($result['included'])); |
|
| 244 | + $this->assertArrayHasKey('first', $result['links']); |
|
| 245 | + $this->assertArrayHasKey('prev', $result['links']); |
|
| 246 | + $this->assertArrayHasKey('self', $result['links']); |
|
| 247 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -253,23 +253,23 @@ discard block |
||
| 253 | 253 | $params = array( |
| 254 | 254 | 'sort' => 'product.label,-product.code' |
| 255 | 255 | ); |
| 256 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
| 257 | - $this->view->addHelper( 'param', $helper ); |
|
| 256 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
| 257 | + $this->view->addHelper('param', $helper); |
|
| 258 | 258 | |
| 259 | 259 | $header = array(); |
| 260 | 260 | $status = 500; |
| 261 | 261 | |
| 262 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 263 | - |
|
| 264 | - $this->assertEquals( 200, $status ); |
|
| 265 | - $this->assertEquals( 1, count( $header ) ); |
|
| 266 | - $this->assertEquals( 28, $result['meta']['total'] ); |
|
| 267 | - $this->assertEquals( 25, count( $result['data'] ) ); |
|
| 268 | - $this->assertEquals( 'product', $result['data'][0]['type'] ); |
|
| 269 | - $this->assertEquals( 'ABCD', $result['data'][0]['attributes']['product.code'] ); |
|
| 270 | - $this->assertEquals( '16 discs', $result['data'][0]['attributes']['product.label'] ); |
|
| 271 | - $this->assertEquals( 0, count( $result['included'] ) ); |
|
| 272 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 262 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 263 | + |
|
| 264 | + $this->assertEquals(200, $status); |
|
| 265 | + $this->assertEquals(1, count($header)); |
|
| 266 | + $this->assertEquals(28, $result['meta']['total']); |
|
| 267 | + $this->assertEquals(25, count($result['data'])); |
|
| 268 | + $this->assertEquals('product', $result['data'][0]['type']); |
|
| 269 | + $this->assertEquals('ABCD', $result['data'][0]['attributes']['product.code']); |
|
| 270 | + $this->assertEquals('16 discs', $result['data'][0]['attributes']['product.label']); |
|
| 271 | + $this->assertEquals(0, count($result['included'])); |
|
| 272 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | |
@@ -282,104 +282,104 @@ discard block |
||
| 282 | 282 | 'sort' => 'product.id', |
| 283 | 283 | 'include' => 'product' |
| 284 | 284 | ); |
| 285 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
| 286 | - $this->view->addHelper( 'param', $helper ); |
|
| 285 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
| 286 | + $this->view->addHelper('param', $helper); |
|
| 287 | 287 | |
| 288 | 288 | $header = array(); |
| 289 | 289 | $status = 500; |
| 290 | 290 | |
| 291 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 291 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 292 | 292 | |
| 293 | - $this->assertEquals( 200, $status ); |
|
| 294 | - $this->assertEquals( 1, count( $header ) ); |
|
| 295 | - $this->assertEquals( 28, $result['meta']['total'] ); |
|
| 296 | - $this->assertEquals( 25, count( $result['data'] ) ); |
|
| 297 | - $this->assertEquals( 'product', $result['data'][0]['type'] ); |
|
| 298 | - $this->assertEquals( 2, count( $result['data'][0]['attributes'] ) ); |
|
| 299 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 293 | + $this->assertEquals(200, $status); |
|
| 294 | + $this->assertEquals(1, count($header)); |
|
| 295 | + $this->assertEquals(28, $result['meta']['total']); |
|
| 296 | + $this->assertEquals(25, count($result['data'])); |
|
| 297 | + $this->assertEquals('product', $result['data'][0]['type']); |
|
| 298 | + $this->assertEquals(2, count($result['data'][0]['attributes'])); |
|
| 299 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | |
| 303 | 303 | public function testPatch() |
| 304 | 304 | { |
| 305 | 305 | $name = 'ClientJsonAdmStandard'; |
| 306 | - $this->context->getConfig()->set( 'mshop/product/manager/name', $name ); |
|
| 306 | + $this->context->getConfig()->set('mshop/product/manager/name', $name); |
|
| 307 | 307 | |
| 308 | - $productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' ) |
|
| 309 | - ->setMethods( array( 'getItem', 'saveItem' ) ) |
|
| 310 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 308 | + $productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard') |
|
| 309 | + ->setMethods(array('getItem', 'saveItem')) |
|
| 310 | + ->setConstructorArgs(array($this->context)) |
|
| 311 | 311 | ->getMock(); |
| 312 | 312 | |
| 313 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub ); |
|
| 313 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub); |
|
| 314 | 314 | |
| 315 | 315 | $item = $productManagerStub->createItem(); |
| 316 | - $item->setLabel( 'test' ); |
|
| 317 | - $item->setId( '-1' ); |
|
| 316 | + $item->setLabel('test'); |
|
| 317 | + $item->setId('-1'); |
|
| 318 | 318 | |
| 319 | - $productManagerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 320 | - $productManagerStub->expects( $this->exactly( 3 ) )->method( 'getItem' ) // 3x due to decorator |
|
| 321 | - ->will( $this->returnValue( $item ) ); |
|
| 319 | + $productManagerStub->expects($this->once())->method('saveItem'); |
|
| 320 | + $productManagerStub->expects($this->exactly(3))->method('getItem') // 3x due to decorator |
|
| 321 | + ->will($this->returnValue($item)); |
|
| 322 | 322 | |
| 323 | 323 | |
| 324 | - $params = array( 'id' => '-1' ); |
|
| 325 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
| 326 | - $this->view->addHelper( 'param', $helper ); |
|
| 324 | + $params = array('id' => '-1'); |
|
| 325 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
| 326 | + $this->view->addHelper('param', $helper); |
|
| 327 | 327 | |
| 328 | 328 | $body = '{"data": {"type": "product", "attributes": {"product.label": "test"}}}'; |
| 329 | 329 | $header = array(); |
| 330 | 330 | $status = 500; |
| 331 | 331 | |
| 332 | - $result = json_decode( $this->object->patch( $body, $header, $status ), true ); |
|
| 333 | - |
|
| 334 | - $this->assertEquals( 200, $status ); |
|
| 335 | - $this->assertEquals( 1, count( $header ) ); |
|
| 336 | - $this->assertEquals( 1, $result['meta']['total'] ); |
|
| 337 | - $this->assertArrayHasKey( 'data', $result ); |
|
| 338 | - $this->assertEquals( '-1', $result['data']['id'] ); |
|
| 339 | - $this->assertEquals( 'product', $result['data']['type'] ); |
|
| 340 | - $this->assertEquals( 'test', $result['data']['attributes']['product.label'] ); |
|
| 341 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
| 342 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 332 | + $result = json_decode($this->object->patch($body, $header, $status), true); |
|
| 333 | + |
|
| 334 | + $this->assertEquals(200, $status); |
|
| 335 | + $this->assertEquals(1, count($header)); |
|
| 336 | + $this->assertEquals(1, $result['meta']['total']); |
|
| 337 | + $this->assertArrayHasKey('data', $result); |
|
| 338 | + $this->assertEquals('-1', $result['data']['id']); |
|
| 339 | + $this->assertEquals('product', $result['data']['type']); |
|
| 340 | + $this->assertEquals('test', $result['data']['attributes']['product.label']); |
|
| 341 | + $this->assertArrayNotHasKey('included', $result); |
|
| 342 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | |
| 346 | 346 | public function testPatchBulk() |
| 347 | 347 | { |
| 348 | 348 | $name = 'ClientJsonAdmStandard'; |
| 349 | - $this->context->getConfig()->set( 'mshop/product/manager/name', $name ); |
|
| 349 | + $this->context->getConfig()->set('mshop/product/manager/name', $name); |
|
| 350 | 350 | |
| 351 | - $productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' ) |
|
| 352 | - ->setMethods( array( 'getItem', 'saveItem' ) ) |
|
| 353 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 351 | + $productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard') |
|
| 352 | + ->setMethods(array('getItem', 'saveItem')) |
|
| 353 | + ->setConstructorArgs(array($this->context)) |
|
| 354 | 354 | ->getMock(); |
| 355 | 355 | |
| 356 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub ); |
|
| 356 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub); |
|
| 357 | 357 | |
| 358 | 358 | $item = $productManagerStub->createItem(); |
| 359 | - $item->setLabel( 'test' ); |
|
| 360 | - $item->setId( '-1' ); |
|
| 359 | + $item->setLabel('test'); |
|
| 360 | + $item->setId('-1'); |
|
| 361 | 361 | |
| 362 | - $productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' ); |
|
| 363 | - $productManagerStub->expects( $this->exactly( 6 ) )->method( 'getItem' ) // 6x due to decorator |
|
| 364 | - ->will( $this->returnValue( $item ) ); |
|
| 362 | + $productManagerStub->expects($this->exactly(2))->method('saveItem'); |
|
| 363 | + $productManagerStub->expects($this->exactly(6))->method('getItem') // 6x due to decorator |
|
| 364 | + ->will($this->returnValue($item)); |
|
| 365 | 365 | |
| 366 | 366 | |
| 367 | 367 | $body = '{"data": [{"id": "-1", "type": "product", "attributes": {"product.label": "test"}}, {"id": "-1", "type": "product", "attributes": {"product.label": "test"}}]}'; |
| 368 | 368 | $header = array(); |
| 369 | 369 | $status = 500; |
| 370 | 370 | |
| 371 | - $result = json_decode( $this->object->patch( $body, $header, $status ), true ); |
|
| 372 | - |
|
| 373 | - $this->assertEquals( 200, $status ); |
|
| 374 | - $this->assertEquals( 1, count( $header ) ); |
|
| 375 | - $this->assertEquals( 2, $result['meta']['total'] ); |
|
| 376 | - $this->assertArrayHasKey( 'data', $result ); |
|
| 377 | - $this->assertEquals( 2, count( $result['data'] ) ); |
|
| 378 | - $this->assertEquals( '-1', $result['data'][0]['id'] ); |
|
| 379 | - $this->assertEquals( 'product', $result['data'][0]['type'] ); |
|
| 380 | - $this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] ); |
|
| 381 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
| 382 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 371 | + $result = json_decode($this->object->patch($body, $header, $status), true); |
|
| 372 | + |
|
| 373 | + $this->assertEquals(200, $status); |
|
| 374 | + $this->assertEquals(1, count($header)); |
|
| 375 | + $this->assertEquals(2, $result['meta']['total']); |
|
| 376 | + $this->assertArrayHasKey('data', $result); |
|
| 377 | + $this->assertEquals(2, count($result['data'])); |
|
| 378 | + $this->assertEquals('-1', $result['data'][0]['id']); |
|
| 379 | + $this->assertEquals('product', $result['data'][0]['type']); |
|
| 380 | + $this->assertEquals('test', $result['data'][0]['attributes']['product.label']); |
|
| 381 | + $this->assertArrayNotHasKey('included', $result); |
|
| 382 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | |
@@ -389,93 +389,93 @@ discard block |
||
| 389 | 389 | $header = array(); |
| 390 | 390 | $status = 500; |
| 391 | 391 | |
| 392 | - $result = json_decode( $this->object->patch( $body, $header, $status ), true ); |
|
| 392 | + $result = json_decode($this->object->patch($body, $header, $status), true); |
|
| 393 | 393 | |
| 394 | - $this->assertEquals( 400, $status ); |
|
| 395 | - $this->assertEquals( 1, count( $header ) ); |
|
| 396 | - $this->assertEquals( 0, $result['meta']['total'] ); |
|
| 397 | - $this->assertArrayHasKey( 'errors', $result ); |
|
| 398 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
| 399 | - $this->assertArrayNotHasKey( 'data', $result ); |
|
| 394 | + $this->assertEquals(400, $status); |
|
| 395 | + $this->assertEquals(1, count($header)); |
|
| 396 | + $this->assertEquals(0, $result['meta']['total']); |
|
| 397 | + $this->assertArrayHasKey('errors', $result); |
|
| 398 | + $this->assertArrayNotHasKey('included', $result); |
|
| 399 | + $this->assertArrayNotHasKey('data', $result); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | |
| 403 | 403 | public function testPost() |
| 404 | 404 | { |
| 405 | 405 | $name = 'ClientJsonAdmStandard'; |
| 406 | - $this->context->getConfig()->set( 'mshop/product/manager/name', $name ); |
|
| 406 | + $this->context->getConfig()->set('mshop/product/manager/name', $name); |
|
| 407 | 407 | |
| 408 | - $productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' ) |
|
| 409 | - ->setMethods( array( 'getItem', 'saveItem' ) ) |
|
| 410 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 408 | + $productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard') |
|
| 409 | + ->setMethods(array('getItem', 'saveItem')) |
|
| 410 | + ->setConstructorArgs(array($this->context)) |
|
| 411 | 411 | ->getMock(); |
| 412 | 412 | |
| 413 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub ); |
|
| 413 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub); |
|
| 414 | 414 | |
| 415 | 415 | $item = $productManagerStub->createItem(); |
| 416 | - $item->setLabel( 'test' ); |
|
| 417 | - $item->setId( '-1' ); |
|
| 416 | + $item->setLabel('test'); |
|
| 417 | + $item->setId('-1'); |
|
| 418 | 418 | |
| 419 | - $productManagerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 420 | - $productManagerStub->expects( $this->once() )->method( 'getItem' ) |
|
| 421 | - ->will( $this->returnValue( $item ) ); |
|
| 419 | + $productManagerStub->expects($this->once())->method('saveItem'); |
|
| 420 | + $productManagerStub->expects($this->once())->method('getItem') |
|
| 421 | + ->will($this->returnValue($item)); |
|
| 422 | 422 | |
| 423 | 423 | |
| 424 | 424 | $body = '{"data": {"type": "product", "attributes": {"product.label": "test"}}}'; |
| 425 | 425 | $header = array(); |
| 426 | 426 | $status = 500; |
| 427 | 427 | |
| 428 | - $result = json_decode( $this->object->post( $body, $header, $status ), true ); |
|
| 429 | - |
|
| 430 | - $this->assertEquals( 201, $status ); |
|
| 431 | - $this->assertEquals( 1, count( $header ) ); |
|
| 432 | - $this->assertEquals( 1, $result['meta']['total'] ); |
|
| 433 | - $this->assertArrayHasKey( 'data', $result ); |
|
| 434 | - $this->assertEquals( '-1', $result['data']['id'] ); |
|
| 435 | - $this->assertEquals( 'product', $result['data']['type'] ); |
|
| 436 | - $this->assertEquals( 'test', $result['data']['attributes']['product.label'] ); |
|
| 437 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
| 438 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 428 | + $result = json_decode($this->object->post($body, $header, $status), true); |
|
| 429 | + |
|
| 430 | + $this->assertEquals(201, $status); |
|
| 431 | + $this->assertEquals(1, count($header)); |
|
| 432 | + $this->assertEquals(1, $result['meta']['total']); |
|
| 433 | + $this->assertArrayHasKey('data', $result); |
|
| 434 | + $this->assertEquals('-1', $result['data']['id']); |
|
| 435 | + $this->assertEquals('product', $result['data']['type']); |
|
| 436 | + $this->assertEquals('test', $result['data']['attributes']['product.label']); |
|
| 437 | + $this->assertArrayNotHasKey('included', $result); |
|
| 438 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | |
| 442 | 442 | public function testPostBulk() |
| 443 | 443 | { |
| 444 | 444 | $name = 'ClientJsonAdmStandard'; |
| 445 | - $this->context->getConfig()->set( 'mshop/product/manager/name', $name ); |
|
| 445 | + $this->context->getConfig()->set('mshop/product/manager/name', $name); |
|
| 446 | 446 | |
| 447 | - $productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' ) |
|
| 448 | - ->setMethods( array( 'getItem', 'saveItem' ) ) |
|
| 449 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 447 | + $productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard') |
|
| 448 | + ->setMethods(array('getItem', 'saveItem')) |
|
| 449 | + ->setConstructorArgs(array($this->context)) |
|
| 450 | 450 | ->getMock(); |
| 451 | 451 | |
| 452 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub ); |
|
| 452 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub); |
|
| 453 | 453 | |
| 454 | 454 | $item = $productManagerStub->createItem(); |
| 455 | - $item->setLabel( 'test' ); |
|
| 456 | - $item->setId( '-1' ); |
|
| 455 | + $item->setLabel('test'); |
|
| 456 | + $item->setId('-1'); |
|
| 457 | 457 | |
| 458 | - $productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' ); |
|
| 459 | - $productManagerStub->expects( $this->exactly( 2 ) )->method( 'getItem' ) |
|
| 460 | - ->will( $this->returnValue( $item ) ); |
|
| 458 | + $productManagerStub->expects($this->exactly(2))->method('saveItem'); |
|
| 459 | + $productManagerStub->expects($this->exactly(2))->method('getItem') |
|
| 460 | + ->will($this->returnValue($item)); |
|
| 461 | 461 | |
| 462 | 462 | |
| 463 | 463 | $body = '{"data": [{"type": "product", "attributes": {"product.label": "test"}}, {"type": "product", "attributes": {"product.label": "test"}}]}'; |
| 464 | 464 | $header = array(); |
| 465 | 465 | $status = 500; |
| 466 | 466 | |
| 467 | - $result = json_decode( $this->object->post( $body, $header, $status ), true ); |
|
| 468 | - |
|
| 469 | - $this->assertEquals( 201, $status ); |
|
| 470 | - $this->assertEquals( 1, count( $header ) ); |
|
| 471 | - $this->assertEquals( 2, $result['meta']['total'] ); |
|
| 472 | - $this->assertArrayHasKey( 'data', $result ); |
|
| 473 | - $this->assertEquals( 2, count( $result['data'] ) ); |
|
| 474 | - $this->assertEquals( '-1', $result['data'][0]['id'] ); |
|
| 475 | - $this->assertEquals( 'product', $result['data'][0]['type'] ); |
|
| 476 | - $this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] ); |
|
| 477 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
| 478 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 467 | + $result = json_decode($this->object->post($body, $header, $status), true); |
|
| 468 | + |
|
| 469 | + $this->assertEquals(201, $status); |
|
| 470 | + $this->assertEquals(1, count($header)); |
|
| 471 | + $this->assertEquals(2, $result['meta']['total']); |
|
| 472 | + $this->assertArrayHasKey('data', $result); |
|
| 473 | + $this->assertEquals(2, count($result['data'])); |
|
| 474 | + $this->assertEquals('-1', $result['data'][0]['id']); |
|
| 475 | + $this->assertEquals('product', $result['data'][0]['type']); |
|
| 476 | + $this->assertEquals('test', $result['data'][0]['attributes']['product.label']); |
|
| 477 | + $this->assertArrayNotHasKey('included', $result); |
|
| 478 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
@@ -485,14 +485,14 @@ discard block |
||
| 485 | 485 | $header = array(); |
| 486 | 486 | $status = 500; |
| 487 | 487 | |
| 488 | - $result = json_decode( $this->object->post( $body, $header, $status ), true ); |
|
| 488 | + $result = json_decode($this->object->post($body, $header, $status), true); |
|
| 489 | 489 | |
| 490 | - $this->assertEquals( 400, $status ); |
|
| 491 | - $this->assertEquals( 1, count( $header ) ); |
|
| 492 | - $this->assertEquals( 0, $result['meta']['total'] ); |
|
| 493 | - $this->assertArrayHasKey( 'errors', $result ); |
|
| 494 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
| 495 | - $this->assertArrayNotHasKey( 'data', $result ); |
|
| 490 | + $this->assertEquals(400, $status); |
|
| 491 | + $this->assertEquals(1, count($header)); |
|
| 492 | + $this->assertEquals(0, $result['meta']['total']); |
|
| 493 | + $this->assertArrayHasKey('errors', $result); |
|
| 494 | + $this->assertArrayNotHasKey('included', $result); |
|
| 495 | + $this->assertArrayNotHasKey('data', $result); |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | |
@@ -502,11 +502,11 @@ discard block |
||
| 502 | 502 | $header = array(); |
| 503 | 503 | $status = 500; |
| 504 | 504 | |
| 505 | - $result = json_decode( $this->object->put( $body, $header, $status ), true ); |
|
| 505 | + $result = json_decode($this->object->put($body, $header, $status), true); |
|
| 506 | 506 | |
| 507 | - $this->assertEquals( 501, $status ); |
|
| 508 | - $this->assertEquals( 1, count( $header ) ); |
|
| 509 | - $this->assertArrayHasKey( 'errors', $result ); |
|
| 507 | + $this->assertEquals(501, $status); |
|
| 508 | + $this->assertEquals(1, count($header)); |
|
| 509 | + $this->assertArrayHasKey('errors', $result); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | |
@@ -515,25 +515,25 @@ discard block |
||
| 515 | 515 | $header = array(); |
| 516 | 516 | $status = 500; |
| 517 | 517 | |
| 518 | - $result = json_decode( $this->object->options( '', $header, $status ), true ); |
|
| 518 | + $result = json_decode($this->object->options('', $header, $status), true); |
|
| 519 | 519 | |
| 520 | - $this->assertEquals( 200, $status ); |
|
| 521 | - $this->assertEquals( 2, count( $header ) ); |
|
| 522 | - $this->assertEquals( 59, count( $result['meta']['resources'] ) ); |
|
| 523 | - $this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) ); |
|
| 524 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 520 | + $this->assertEquals(200, $status); |
|
| 521 | + $this->assertEquals(2, count($header)); |
|
| 522 | + $this->assertEquals(59, count($result['meta']['resources'])); |
|
| 523 | + $this->assertGreaterThan(0, count($result['meta']['attributes'])); |
|
| 524 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | |
| 528 | - protected function getProductItem( $code = 'CNC' ) |
|
| 528 | + protected function getProductItem($code = 'CNC') |
|
| 529 | 529 | { |
| 530 | - $manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context ); |
|
| 530 | + $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context); |
|
| 531 | 531 | $search = $manager->createSearch(); |
| 532 | - $search->setConditions( $search->compare( '==', 'product.code', $code ) ); |
|
| 533 | - $items = $manager->searchItems( $search ); |
|
| 532 | + $search->setConditions($search->compare('==', 'product.code', $code)); |
|
| 533 | + $items = $manager->searchItems($search); |
|
| 534 | 534 | |
| 535 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 536 | - throw new \Exception( sprintf( 'No product item with code "%1$s" found', $code ) ); |
|
| 535 | + if (($item = reset($items)) === false) { |
|
| 536 | + throw new \Exception(sprintf('No product item with code "%1$s" found', $code)); |
|
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | return $item; |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $context = \TestHelperJadm::getContext(); |
| 17 | 17 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 18 | 18 | |
| 19 | - $client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' ); |
|
| 20 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client ); |
|
| 19 | + $client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order'); |
|
| 20 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | $context = \TestHelperJadm::getContext(); |
| 27 | 27 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 28 | 28 | |
| 29 | - $client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' ); |
|
| 30 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client ); |
|
| 29 | + $client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base'); |
|
| 30 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | $context = \TestHelperJadm::getContext(); |
| 37 | 37 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 38 | 38 | |
| 39 | - $client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, '' ); |
|
| 40 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client ); |
|
| 39 | + $client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, ''); |
|
| 40 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -46,68 +46,68 @@ discard block |
||
| 46 | 46 | $context = \TestHelperJadm::getContext(); |
| 47 | 47 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 48 | 48 | |
| 49 | - $this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' ); |
|
| 50 | - \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, '%^' ); |
|
| 49 | + $this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception'); |
|
| 50 | + \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, '%^'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | public function testClear() |
| 55 | 55 | { |
| 56 | - $cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true ); |
|
| 56 | + $cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true); |
|
| 57 | 57 | |
| 58 | 58 | $context = \TestHelperJadm::getContext(); |
| 59 | 59 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 60 | 60 | |
| 61 | - $client1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' ); |
|
| 61 | + $client1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order'); |
|
| 62 | 62 | \Aimeos\Admin\JsonAdm\Factory::clear(); |
| 63 | - $client2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' ); |
|
| 63 | + $client2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order'); |
|
| 64 | 64 | |
| 65 | - \Aimeos\Admin\JsonAdm\Factory::setCache( $cache ); |
|
| 65 | + \Aimeos\Admin\JsonAdm\Factory::setCache($cache); |
|
| 66 | 66 | |
| 67 | - $this->assertNotSame( $client1, $client2 ); |
|
| 67 | + $this->assertNotSame($client1, $client2); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | public function testClearSite() |
| 72 | 72 | { |
| 73 | - $cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true ); |
|
| 73 | + $cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true); |
|
| 74 | 74 | |
| 75 | 75 | $context = \TestHelperJadm::getContext(); |
| 76 | 76 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 77 | 77 | |
| 78 | - $cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' ); |
|
| 79 | - $cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' ); |
|
| 80 | - \Aimeos\Admin\JsonAdm\Factory::clear( (string) $context ); |
|
| 78 | + $cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order'); |
|
| 79 | + $cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base'); |
|
| 80 | + \Aimeos\Admin\JsonAdm\Factory::clear((string) $context); |
|
| 81 | 81 | |
| 82 | - $cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' ); |
|
| 83 | - $cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' ); |
|
| 82 | + $cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order'); |
|
| 83 | + $cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base'); |
|
| 84 | 84 | |
| 85 | - \Aimeos\Admin\JsonAdm\Factory::setCache( $cache ); |
|
| 85 | + \Aimeos\Admin\JsonAdm\Factory::setCache($cache); |
|
| 86 | 86 | |
| 87 | - $this->assertNotSame( $cntlA1, $cntlA2 ); |
|
| 88 | - $this->assertNotSame( $cntlB1, $cntlB2 ); |
|
| 87 | + $this->assertNotSame($cntlA1, $cntlA2); |
|
| 88 | + $this->assertNotSame($cntlB1, $cntlB2); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | public function testClearSpecific() |
| 93 | 93 | { |
| 94 | - $cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true ); |
|
| 94 | + $cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true); |
|
| 95 | 95 | |
| 96 | 96 | $context = \TestHelperJadm::getContext(); |
| 97 | 97 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 98 | 98 | |
| 99 | - $cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' ); |
|
| 100 | - $cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' ); |
|
| 99 | + $cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order'); |
|
| 100 | + $cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base'); |
|
| 101 | 101 | |
| 102 | - \Aimeos\Admin\JsonAdm\Factory::clear( (string) $context, 'order' ); |
|
| 102 | + \Aimeos\Admin\JsonAdm\Factory::clear((string) $context, 'order'); |
|
| 103 | 103 | |
| 104 | - $cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' ); |
|
| 105 | - $cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' ); |
|
| 104 | + $cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order'); |
|
| 105 | + $cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base'); |
|
| 106 | 106 | |
| 107 | - \Aimeos\Admin\JsonAdm\Factory::setCache( $cache ); |
|
| 107 | + \Aimeos\Admin\JsonAdm\Factory::setCache($cache); |
|
| 108 | 108 | |
| 109 | - $this->assertNotSame( $cntlA1, $cntlA2 ); |
|
| 110 | - $this->assertSame( $cntlB1, $cntlB2 ); |
|
| 109 | + $this->assertNotSame($cntlA1, $cntlA2); |
|
| 110 | + $this->assertSame($cntlB1, $cntlB2); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 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,26 +30,26 @@ discard block |
||
| 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 | 40 | $header = array(); |
| 41 | 41 | $status = 500; |
| 42 | 42 | |
| 43 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 43 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 44 | 44 | |
| 45 | - $this->assertEquals( 200, $status ); |
|
| 46 | - $this->assertEquals( 1, count( $header ) ); |
|
| 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 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 45 | + $this->assertEquals(200, $status); |
|
| 46 | + $this->assertEquals(1, count($header)); |
|
| 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 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -62,22 +62,22 @@ discard block |
||
| 62 | 62 | 'sort' => 'coupon.id', |
| 63 | 63 | 'include' => 'coupon/code' |
| 64 | 64 | ); |
| 65 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
| 66 | - $this->view->addHelper( 'param', $helper ); |
|
| 65 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
| 66 | + $this->view->addHelper('param', $helper); |
|
| 67 | 67 | |
| 68 | 68 | $header = array(); |
| 69 | 69 | $status = 500; |
| 70 | 70 | |
| 71 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 72 | - |
|
| 73 | - $this->assertEquals( 200, $status ); |
|
| 74 | - $this->assertEquals( 1, count( $header ) ); |
|
| 75 | - $this->assertEquals( 5, $result['meta']['total'] ); |
|
| 76 | - $this->assertEquals( 5, count( $result['data'] ) ); |
|
| 77 | - $this->assertEquals( 'coupon', $result['data'][0]['type'] ); |
|
| 78 | - $this->assertEquals( 2, count( $result['data'][0]['attributes'] ) ); |
|
| 79 | - $this->assertEquals( 1, count( $result['data'][0]['relationships']['coupon/code'] ) ); |
|
| 80 | - $this->assertEquals( 5, count( $result['included'] ) ); |
|
| 81 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 71 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 72 | + |
|
| 73 | + $this->assertEquals(200, $status); |
|
| 74 | + $this->assertEquals(1, count($header)); |
|
| 75 | + $this->assertEquals(5, $result['meta']['total']); |
|
| 76 | + $this->assertEquals(5, count($result['data'])); |
|
| 77 | + $this->assertEquals('coupon', $result['data'][0]['type']); |
|
| 78 | + $this->assertEquals(2, count($result['data'][0]['attributes'])); |
|
| 79 | + $this->assertEquals(1, count($result['data'][0]['relationships']['coupon/code'])); |
|
| 80 | + $this->assertEquals(5, count($result['included'])); |
|
| 81 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 23 | 23 | $this->view = $this->context->getView(); |
| 24 | 24 | |
| 25 | - $this->object = new \Aimeos\Admin\JsonAdm\Catalog\Standard( $this->context, $this->view, $templatePaths, 'catalog' ); |
|
| 25 | + $this->object = new \Aimeos\Admin\JsonAdm\Catalog\Standard($this->context, $this->view, $templatePaths, 'catalog'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
@@ -30,25 +30,25 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $params = array( |
| 32 | 32 | 'filter' => array( |
| 33 | - '==' => array( 'catalog.code' => 'cafe' ) |
|
| 33 | + '==' => array('catalog.code' => 'cafe') |
|
| 34 | 34 | ), |
| 35 | 35 | 'include' => 'text' |
| 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 | 40 | $header = array(); |
| 41 | 41 | $status = 500; |
| 42 | 42 | |
| 43 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 43 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 44 | 44 | |
| 45 | - $this->assertEquals( 200, $status ); |
|
| 46 | - $this->assertEquals( 1, count( $header ) ); |
|
| 47 | - $this->assertEquals( 1, $result['meta']['total'] ); |
|
| 48 | - $this->assertEquals( 1, count( $result['data'] ) ); |
|
| 49 | - $this->assertEquals( 'catalog', $result['data'][0]['type'] ); |
|
| 50 | - $this->assertEquals( 6, count( $result['data'][0]['relationships']['text'] ) ); |
|
| 51 | - $this->assertEquals( 6, count( $result['included'] ) ); |
|
| 52 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 45 | + $this->assertEquals(200, $status); |
|
| 46 | + $this->assertEquals(1, count($header)); |
|
| 47 | + $this->assertEquals(1, $result['meta']['total']); |
|
| 48 | + $this->assertEquals(1, count($result['data'])); |
|
| 49 | + $this->assertEquals('catalog', $result['data'][0]['type']); |
|
| 50 | + $this->assertEquals(6, count($result['data'][0]['relationships']['text'])); |
|
| 51 | + $this->assertEquals(6, count($result['included'])); |
|
| 52 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 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,27 +30,27 @@ discard block |
||
| 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 | 40 | $header = array(); |
| 41 | 41 | $status = 500; |
| 42 | 42 | |
| 43 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 44 | - |
|
| 45 | - $this->assertEquals( 200, $status ); |
|
| 46 | - $this->assertEquals( 1, count( $header ) ); |
|
| 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 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 43 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 44 | + |
|
| 45 | + $this->assertEquals(200, $status); |
|
| 46 | + $this->assertEquals(1, count($header)); |
|
| 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 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
@@ -63,22 +63,22 @@ discard block |
||
| 63 | 63 | 'sort' => 'customer.id', |
| 64 | 64 | 'include' => 'customer/address' |
| 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 | 69 | $header = array(); |
| 70 | 70 | $status = 500; |
| 71 | 71 | |
| 72 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 73 | - |
|
| 74 | - $this->assertEquals( 200, $status ); |
|
| 75 | - $this->assertEquals( 1, count( $header ) ); |
|
| 76 | - $this->assertEquals( 3, $result['meta']['total'] ); |
|
| 77 | - $this->assertEquals( 3, count( $result['data'] ) ); |
|
| 78 | - $this->assertEquals( 'customer', $result['data'][0]['type'] ); |
|
| 79 | - $this->assertEquals( 2, count( $result['data'][0]['attributes'] ) ); |
|
| 80 | - $this->assertEquals( 1, count( $result['data'][0]['relationships']['customer/address'] ) ); |
|
| 81 | - $this->assertEquals( 4, count( $result['included'] ) ); |
|
| 82 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 72 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 73 | + |
|
| 74 | + $this->assertEquals(200, $status); |
|
| 75 | + $this->assertEquals(1, count($header)); |
|
| 76 | + $this->assertEquals(3, $result['meta']['total']); |
|
| 77 | + $this->assertEquals(3, count($result['data'])); |
|
| 78 | + $this->assertEquals('customer', $result['data'][0]['type']); |
|
| 79 | + $this->assertEquals(2, count($result['data'][0]['attributes'])); |
|
| 80 | + $this->assertEquals(1, count($result['data'][0]['relationships']['customer/address'])); |
|
| 81 | + $this->assertEquals(4, count($result['included'])); |
|
| 82 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $templatePaths = \TestHelperJadm::getJsonadmPaths(); |
| 23 | 23 | $this->view = $this->context->getView(); |
| 24 | 24 | |
| 25 | - $this->object = new \Aimeos\Admin\JsonAdm\Supplier\Standard( $this->context, $this->view, $templatePaths, 'supplier' ); |
|
| 25 | + $this->object = new \Aimeos\Admin\JsonAdm\Supplier\Standard($this->context, $this->view, $templatePaths, 'supplier'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
@@ -30,27 +30,27 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $params = array( |
| 32 | 32 | 'filter' => array( |
| 33 | - '==' => array( 'supplier.code' => 'unitCode001' ) |
|
| 33 | + '==' => array('supplier.code' => 'unitCode001') |
|
| 34 | 34 | ), |
| 35 | 35 | 'include' => 'text,supplier/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 | 40 | $header = array(); |
| 41 | 41 | $status = 500; |
| 42 | 42 | |
| 43 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 44 | - |
|
| 45 | - $this->assertEquals( 200, $status ); |
|
| 46 | - $this->assertEquals( 1, count( $header ) ); |
|
| 47 | - $this->assertEquals( 1, $result['meta']['total'] ); |
|
| 48 | - $this->assertEquals( 1, count( $result['data'] ) ); |
|
| 49 | - $this->assertEquals( 'supplier', $result['data'][0]['type'] ); |
|
| 50 | - $this->assertEquals( 3, count( $result['data'][0]['relationships']['text'] ) ); |
|
| 51 | - $this->assertEquals( 1, count( $result['data'][0]['relationships']['supplier/address'] ) ); |
|
| 52 | - $this->assertEquals( 4, count( $result['included'] ) ); |
|
| 53 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 43 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 44 | + |
|
| 45 | + $this->assertEquals(200, $status); |
|
| 46 | + $this->assertEquals(1, count($header)); |
|
| 47 | + $this->assertEquals(1, $result['meta']['total']); |
|
| 48 | + $this->assertEquals(1, count($result['data'])); |
|
| 49 | + $this->assertEquals('supplier', $result['data'][0]['type']); |
|
| 50 | + $this->assertEquals(3, count($result['data'][0]['relationships']['text'])); |
|
| 51 | + $this->assertEquals(1, count($result['data'][0]['relationships']['supplier/address'])); |
|
| 52 | + $this->assertEquals(4, count($result['included'])); |
|
| 53 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
@@ -63,22 +63,22 @@ discard block |
||
| 63 | 63 | 'sort' => 'supplier.id', |
| 64 | 64 | 'include' => 'supplier/address' |
| 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 | 69 | $header = array(); |
| 70 | 70 | $status = 500; |
| 71 | 71 | |
| 72 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
| 73 | - |
|
| 74 | - $this->assertEquals( 200, $status ); |
|
| 75 | - $this->assertEquals( 1, count( $header ) ); |
|
| 76 | - $this->assertEquals( 3, $result['meta']['total'] ); |
|
| 77 | - $this->assertEquals( 3, count( $result['data'] ) ); |
|
| 78 | - $this->assertEquals( 'supplier', $result['data'][0]['type'] ); |
|
| 79 | - $this->assertEquals( 2, count( $result['data'][0]['attributes'] ) ); |
|
| 80 | - $this->assertEquals( 1, count( $result['data'][0]['relationships']['supplier/address'] ) ); |
|
| 81 | - $this->assertEquals( 3, count( $result['included'] ) ); |
|
| 82 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
| 72 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
| 73 | + |
|
| 74 | + $this->assertEquals(200, $status); |
|
| 75 | + $this->assertEquals(1, count($header)); |
|
| 76 | + $this->assertEquals(3, $result['meta']['total']); |
|
| 77 | + $this->assertEquals(3, count($result['data'])); |
|
| 78 | + $this->assertEquals('supplier', $result['data'][0]['type']); |
|
| 79 | + $this->assertEquals(2, count($result['data'][0]['attributes'])); |
|
| 80 | + $this->assertEquals(1, count($result['data'][0]['relationships']['supplier/address'])); |
|
| 81 | + $this->assertEquals(3, count($result['included'])); |
|
| 82 | + $this->assertArrayNotHasKey('errors', $result); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | \ No newline at end of file |
@@ -19,77 +19,77 @@ discard block |
||
| 19 | 19 | $this->context = \TestHelperJadm::getContext(); |
| 20 | 20 | $config = $this->context->getConfig(); |
| 21 | 21 | |
| 22 | - $config->set( 'admin/jsonadm/common/decorators/default', array() ); |
|
| 23 | - $config->set( 'admin/jsonadm/decorators/global', array() ); |
|
| 24 | - $config->set( 'admin/jsonadm/decorators/local', array() ); |
|
| 22 | + $config->set('admin/jsonadm/common/decorators/default', array()); |
|
| 23 | + $config->set('admin/jsonadm/decorators/global', array()); |
|
| 24 | + $config->set('admin/jsonadm/decorators/local', array()); |
|
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | public function testInjectClient() |
| 30 | 30 | { |
| 31 | - $cntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' ); |
|
| 32 | - \Aimeos\Admin\JsonAdm\Factory::injectClient( '\\Aimeos\\Admin\\JsonAdm\\Standard', $cntl ); |
|
| 31 | + $cntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard'); |
|
| 32 | + \Aimeos\Admin\JsonAdm\Factory::injectClient('\\Aimeos\\Admin\\JsonAdm\\Standard', $cntl); |
|
| 33 | 33 | |
| 34 | - $iCntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' ); |
|
| 34 | + $iCntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard'); |
|
| 35 | 35 | |
| 36 | - $this->assertSame( $cntl, $iCntl ); |
|
| 36 | + $this->assertSame($cntl, $iCntl); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testInjectClientReset() |
| 41 | 41 | { |
| 42 | - $cntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' ); |
|
| 43 | - \Aimeos\Admin\JsonAdm\Factory::injectClient( '\\Aimeos\\Admin\\JsonAdm\\Standard', $cntl ); |
|
| 44 | - \Aimeos\Admin\JsonAdm\Factory::injectClient( '\\Aimeos\\Admin\\JsonAdm\\Standard', null ); |
|
| 42 | + $cntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard'); |
|
| 43 | + \Aimeos\Admin\JsonAdm\Factory::injectClient('\\Aimeos\\Admin\\JsonAdm\\Standard', $cntl); |
|
| 44 | + \Aimeos\Admin\JsonAdm\Factory::injectClient('\\Aimeos\\Admin\\JsonAdm\\Standard', null); |
|
| 45 | 45 | |
| 46 | - $new = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' ); |
|
| 46 | + $new = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard'); |
|
| 47 | 47 | |
| 48 | - $this->assertNotSame( $cntl, $new ); |
|
| 48 | + $this->assertNotSame($cntl, $new); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testAddDecoratorsInvalidName() |
| 53 | 53 | { |
| 54 | - $decorators = array( '$' ); |
|
| 54 | + $decorators = array('$'); |
|
| 55 | 55 | $view = $this->context->getView(); |
| 56 | - $cntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' ); |
|
| 56 | + $cntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard'); |
|
| 57 | 57 | |
| 58 | - $this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' ); |
|
| 59 | - \Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $cntl, $decorators, 'Test', $this->context, $view, array(), 'attribute' ); |
|
| 58 | + $this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception'); |
|
| 59 | + \Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic($cntl, $decorators, 'Test', $this->context, $view, array(), 'attribute'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | public function testAddDecoratorsInvalidClass() |
| 64 | 64 | { |
| 65 | - $decorators = array( 'Test' ); |
|
| 65 | + $decorators = array('Test'); |
|
| 66 | 66 | $view = $this->context->getView(); |
| 67 | - $cntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' ); |
|
| 67 | + $cntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard'); |
|
| 68 | 68 | |
| 69 | - $this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' ); |
|
| 70 | - \Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $cntl, $decorators, 'TestDecorator', $this->context, $view, array(), 'attribute' ); |
|
| 69 | + $this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception'); |
|
| 70 | + \Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic($cntl, $decorators, 'TestDecorator', $this->context, $view, array(), 'attribute'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | public function testAddDecoratorsInvalidInterface() |
| 75 | 75 | { |
| 76 | - $decorators = array( 'Test' ); |
|
| 76 | + $decorators = array('Test'); |
|
| 77 | 77 | $view = $this->context->getView(); |
| 78 | - $cntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' ); |
|
| 78 | + $cntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard'); |
|
| 79 | 79 | |
| 80 | - $this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' ); |
|
| 81 | - \Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $cntl, $decorators, |
|
| 82 | - '\\Aimeos\\Admin\\Jsonadm\\Common\\Decorator\\', $this->context, $view, array(), 'attribute' ); |
|
| 80 | + $this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception'); |
|
| 81 | + \Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic($cntl, $decorators, |
|
| 82 | + '\\Aimeos\\Admin\\Jsonadm\\Common\\Decorator\\', $this->context, $view, array(), 'attribute'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | public function testAddClientDecoratorsExcludes() |
| 87 | 87 | { |
| 88 | - $this->context->getConfig()->set( 'admin/jsonadm/decorators/excludes', array( 'TestDecorator' ) ); |
|
| 89 | - $this->context->getConfig()->set( 'admin/jsonadm/common/decorators/default', array( 'TestDecorator' ) ); |
|
| 88 | + $this->context->getConfig()->set('admin/jsonadm/decorators/excludes', array('TestDecorator')); |
|
| 89 | + $this->context->getConfig()->set('admin/jsonadm/common/decorators/default', array('TestDecorator')); |
|
| 90 | 90 | |
| 91 | - $this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' ); |
|
| 92 | - \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' ); |
|
| 91 | + $this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception'); |
|
| 92 | + \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard'); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | class TestAbstract |
| 98 | 98 | extends \Aimeos\Admin\JsonAdm\Common\Factory\Base |
| 99 | 99 | { |
| 100 | - public static function addDecoratorsPublic( \Aimeos\Admin\JsonAdm\Iface $client, array $decorators, $classprefix, |
|
| 101 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path ) |
|
| 100 | + public static function addDecoratorsPublic(\Aimeos\Admin\JsonAdm\Iface $client, array $decorators, $classprefix, |
|
| 101 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path) |
|
| 102 | 102 | { |
| 103 | - self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); |
|
| 103 | + self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public static function addClientDecoratorsPublic( \Aimeos\Admin\JsonAdm\Iface $client, |
|
| 107 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path ) |
|
| 106 | + public static function addClientDecoratorsPublic(\Aimeos\Admin\JsonAdm\Iface $client, |
|
| 107 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path) |
|
| 108 | 108 | { |
| 109 | - self::addClientDecorators( $client, $view, $context, $templatePaths, $path ); |
|
| 109 | + self::addClientDecorators($client, $view, $context, $templatePaths, $path); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -20,17 +20,17 @@ discard block |
||
| 20 | 20 | $context = \TestHelperJadm::getContext(); |
| 21 | 21 | $view = $context->getView(); |
| 22 | 22 | |
| 23 | - $this->stub = $this->getMockBuilder( '\\Aimeos\\Admin\\JsonAdm\\Standard' ) |
|
| 24 | - ->setConstructorArgs( array( $context, $view, array(), 'attribute' ) ) |
|
| 23 | + $this->stub = $this->getMockBuilder('\\Aimeos\\Admin\\JsonAdm\\Standard') |
|
| 24 | + ->setConstructorArgs(array($context, $view, array(), 'attribute')) |
|
| 25 | 25 | ->getMock(); |
| 26 | 26 | |
| 27 | - $this->object = new TestBase( $this->stub, $context, $view, array(), 'attribute' ); |
|
| 27 | + $this->object = new TestBase($this->stub, $context, $view, array(), 'attribute'); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | protected function tearDown() |
| 32 | 32 | { |
| 33 | - unset( $this->object, $this->stub ); |
|
| 33 | + unset($this->object, $this->stub); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | $status = 0; |
| 40 | 40 | $header = array(); |
| 41 | 41 | |
| 42 | - $this->stub->expects( $this->once() ) |
|
| 43 | - ->method( 'delete' ) |
|
| 44 | - ->will( $this->returnValue( 'test' ) ); |
|
| 42 | + $this->stub->expects($this->once()) |
|
| 43 | + ->method('delete') |
|
| 44 | + ->will($this->returnValue('test')); |
|
| 45 | 45 | |
| 46 | - $this->assertEquals( 'test', $this->object->delete( '', $header, $status ) ); |
|
| 46 | + $this->assertEquals('test', $this->object->delete('', $header, $status)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | $status = 0; |
| 53 | 53 | $header = array(); |
| 54 | 54 | |
| 55 | - $this->stub->expects( $this->once() ) |
|
| 56 | - ->method( 'get' ) |
|
| 57 | - ->will( $this->returnValue( 'test' ) ); |
|
| 55 | + $this->stub->expects($this->once()) |
|
| 56 | + ->method('get') |
|
| 57 | + ->will($this->returnValue('test')); |
|
| 58 | 58 | |
| 59 | - $this->assertEquals( 'test', $this->object->get( '', $header, $status ) ); |
|
| 59 | + $this->assertEquals('test', $this->object->get('', $header, $status)); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | $status = 0; |
| 66 | 66 | $header = array(); |
| 67 | 67 | |
| 68 | - $this->stub->expects( $this->once() ) |
|
| 69 | - ->method( 'patch' ) |
|
| 70 | - ->will( $this->returnValue( 'test' ) ); |
|
| 68 | + $this->stub->expects($this->once()) |
|
| 69 | + ->method('patch') |
|
| 70 | + ->will($this->returnValue('test')); |
|
| 71 | 71 | |
| 72 | - $this->assertEquals( 'test', $this->object->patch( '', $header, $status ) ); |
|
| 72 | + $this->assertEquals('test', $this->object->patch('', $header, $status)); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | $status = 0; |
| 79 | 79 | $header = array(); |
| 80 | 80 | |
| 81 | - $this->stub->expects( $this->once() ) |
|
| 82 | - ->method( 'post' ) |
|
| 83 | - ->will( $this->returnValue( 'test' ) ); |
|
| 81 | + $this->stub->expects($this->once()) |
|
| 82 | + ->method('post') |
|
| 83 | + ->will($this->returnValue('test')); |
|
| 84 | 84 | |
| 85 | - $this->assertEquals( 'test', $this->object->post( '', $header, $status ) ); |
|
| 85 | + $this->assertEquals('test', $this->object->post('', $header, $status)); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | $status = 0; |
| 92 | 92 | $header = array(); |
| 93 | 93 | |
| 94 | - $this->stub->expects( $this->once() ) |
|
| 95 | - ->method( 'put' ) |
|
| 96 | - ->will( $this->returnValue( 'test' ) ); |
|
| 94 | + $this->stub->expects($this->once()) |
|
| 95 | + ->method('put') |
|
| 96 | + ->will($this->returnValue('test')); |
|
| 97 | 97 | |
| 98 | - $this->assertEquals( 'test', $this->object->put( '', $header, $status ) ); |
|
| 98 | + $this->assertEquals('test', $this->object->put('', $header, $status)); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
@@ -104,35 +104,35 @@ discard block |
||
| 104 | 104 | $status = 0; |
| 105 | 105 | $header = array(); |
| 106 | 106 | |
| 107 | - $this->stub->expects( $this->once() ) |
|
| 108 | - ->method( 'options' ) |
|
| 109 | - ->will( $this->returnValue( 'test' ) ); |
|
| 107 | + $this->stub->expects($this->once()) |
|
| 108 | + ->method('options') |
|
| 109 | + ->will($this->returnValue('test')); |
|
| 110 | 110 | |
| 111 | - $this->assertEquals( 'test', $this->object->options( '', $header, $status ) ); |
|
| 111 | + $this->assertEquals('test', $this->object->options('', $header, $status)); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | public function testGetContext() |
| 116 | 116 | { |
| 117 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Context\\Item\\Iface', $this->object->getContextPublic() ); |
|
| 117 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Context\\Item\\Iface', $this->object->getContextPublic()); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | public function testGetTemplatePaths() |
| 122 | 122 | { |
| 123 | - $this->assertEquals( array(), $this->object->getTemplatePathsPublic() ); |
|
| 123 | + $this->assertEquals(array(), $this->object->getTemplatePathsPublic()); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | public function testGetPath() |
| 128 | 128 | { |
| 129 | - $this->assertEquals( 'attribute', $this->object->getPathPublic() ); |
|
| 129 | + $this->assertEquals('attribute', $this->object->getPathPublic()); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | public function testCall() |
| 134 | 134 | { |
| 135 | - $this->markTestIncomplete( 'PHP warning is triggered instead of exception' ); |
|
| 135 | + $this->markTestIncomplete('PHP warning is triggered instead of exception'); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | } |