| @@ 123-142 (lines=20) @@ | ||
| 120 | } |
|
| 121 | ||
| 122 | ||
| 123 | public function testGetMShopException() |
|
| 124 | { |
|
| 125 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 126 | ||
| 127 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Attribute\Standard' ) |
|
| 128 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'attribute'] ) |
|
| 129 | ->setMethods( ['getItems'] ) |
|
| 130 | ->getMock(); |
|
| 131 | ||
| 132 | $object->expects( $this->once() )->method( 'getItems' ) |
|
| 133 | ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 134 | ||
| 135 | ||
| 136 | $response = $object->get( $this->view->request(), $this->view->response() ); |
|
| 137 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 138 | ||
| 139 | ||
| 140 | $this->assertEquals( 404, $response->getStatusCode() ); |
|
| 141 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 142 | } |
|
| 143 | ||
| 144 | ||
| 145 | public function testGetException() |
|
| @@ 145-164 (lines=20) @@ | ||
| 142 | } |
|
| 143 | ||
| 144 | ||
| 145 | public function testGetException() |
|
| 146 | { |
|
| 147 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 148 | ||
| 149 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Attribute\Standard' ) |
|
| 150 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'attribute'] ) |
|
| 151 | ->setMethods( ['getItems'] ) |
|
| 152 | ->getMock(); |
|
| 153 | ||
| 154 | $object->expects( $this->once() )->method( 'getItems' ) |
|
| 155 | ->will( $this->throwException( new \Exception() ) ); |
|
| 156 | ||
| 157 | ||
| 158 | $response = $object->get( $this->view->request(), $this->view->response() ); |
|
| 159 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 160 | ||
| 161 | ||
| 162 | $this->assertEquals( 500, $response->getStatusCode() ); |
|
| 163 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 164 | } |
|
| 165 | } |
|
| @@ 97-116 (lines=20) @@ | ||
| 94 | } |
|
| 95 | ||
| 96 | ||
| 97 | public function testGetMShopException() |
|
| 98 | { |
|
| 99 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 100 | ||
| 101 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Catalog\Standard' ) |
|
| 102 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'catalog'] ) |
|
| 103 | ->setMethods( ['getItem'] ) |
|
| 104 | ->getMock(); |
|
| 105 | ||
| 106 | $object->expects( $this->once() )->method( 'getItem' ) |
|
| 107 | ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 108 | ||
| 109 | ||
| 110 | $response = $object->get( $this->view->request(), $this->view->response() ); |
|
| 111 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 112 | ||
| 113 | ||
| 114 | $this->assertEquals( 404, $response->getStatusCode() ); |
|
| 115 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 116 | } |
|
| 117 | ||
| 118 | ||
| 119 | public function testGetException() |
|
| @@ 119-138 (lines=20) @@ | ||
| 116 | } |
|
| 117 | ||
| 118 | ||
| 119 | public function testGetException() |
|
| 120 | { |
|
| 121 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 122 | ||
| 123 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Catalog\Standard' ) |
|
| 124 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'catalog'] ) |
|
| 125 | ->setMethods( ['getItem'] ) |
|
| 126 | ->getMock(); |
|
| 127 | ||
| 128 | $object->expects( $this->once() )->method( 'getItem' ) |
|
| 129 | ->will( $this->throwException( new \Exception() ) ); |
|
| 130 | ||
| 131 | ||
| 132 | $response = $object->get( $this->view->request(), $this->view->response() ); |
|
| 133 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 134 | ||
| 135 | ||
| 136 | $this->assertEquals( 500, $response->getStatusCode() ); |
|
| 137 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 138 | } |
|
| 139 | } |
|
| @@ 174-193 (lines=20) @@ | ||
| 171 | } |
|
| 172 | ||
| 173 | ||
| 174 | public function testGetMShopException() |
|
| 175 | { |
|
| 176 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 177 | ||
| 178 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Product\Standard' ) |
|
| 179 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'product'] ) |
|
| 180 | ->setMethods( ['getItems'] ) |
|
| 181 | ->getMock(); |
|
| 182 | ||
| 183 | $object->expects( $this->once() )->method( 'getItems' ) |
|
| 184 | ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 185 | ||
| 186 | ||
| 187 | $response = $object->get( $this->view->request(), $this->view->response() ); |
|
| 188 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 189 | ||
| 190 | ||
| 191 | $this->assertEquals( 404, $response->getStatusCode() ); |
|
| 192 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 193 | } |
|
| 194 | ||
| 195 | ||
| 196 | public function testGetException() |
|
| @@ 196-215 (lines=20) @@ | ||
| 193 | } |
|
| 194 | ||
| 195 | ||
| 196 | public function testGetException() |
|
| 197 | { |
|
| 198 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 199 | ||
| 200 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Product\Standard' ) |
|
| 201 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'product'] ) |
|
| 202 | ->setMethods( ['getItems'] ) |
|
| 203 | ->getMock(); |
|
| 204 | ||
| 205 | $object->expects( $this->once() )->method( 'getItems' ) |
|
| 206 | ->will( $this->throwException( new \Exception() ) ); |
|
| 207 | ||
| 208 | ||
| 209 | $response = $object->get( $this->view->request(), $this->view->response() ); |
|
| 210 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 211 | ||
| 212 | ||
| 213 | $this->assertEquals( 500, $response->getStatusCode() ); |
|
| 214 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 215 | } |
|
| 216 | } |
|
| @@ 44-63 (lines=20) @@ | ||
| 41 | } |
|
| 42 | ||
| 43 | ||
| 44 | public function testOptionsException() |
|
| 45 | { |
|
| 46 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 47 | ||
| 48 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Standard' ) |
|
| 49 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, ''] ) |
|
| 50 | ->setMethods( ['getContext'] ) |
|
| 51 | ->getMock(); |
|
| 52 | ||
| 53 | $object->expects( $this->once() )->method( 'getContext' ) |
|
| 54 | ->will( $this->throwException( new \Exception() ) ); |
|
| 55 | ||
| 56 | ||
| 57 | $response = $object->options( $this->view->request(), $this->view->response() ); |
|
| 58 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 59 | ||
| 60 | ||
| 61 | $this->assertEquals( 500, $response->getStatusCode() ); |
|
| 62 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 63 | } |
|
| 64 | } |
|
| @@ 85-104 (lines=20) @@ | ||
| 82 | } |
|
| 83 | ||
| 84 | ||
| 85 | public function testGetMShopException() |
|
| 86 | { |
|
| 87 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 88 | ||
| 89 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Stock\Standard' ) |
|
| 90 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'stock'] ) |
|
| 91 | ->setMethods( ['getItems'] ) |
|
| 92 | ->getMock(); |
|
| 93 | ||
| 94 | $object->expects( $this->once() )->method( 'getItems' ) |
|
| 95 | ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 96 | ||
| 97 | ||
| 98 | $response = $object->get( $this->view->request(), $this->view->response() ); |
|
| 99 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 100 | ||
| 101 | ||
| 102 | $this->assertEquals( 404, $response->getStatusCode() ); |
|
| 103 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 104 | } |
|
| 105 | ||
| 106 | ||
| 107 | public function testGetException() |
|
| @@ 107-126 (lines=20) @@ | ||
| 104 | } |
|
| 105 | ||
| 106 | ||
| 107 | public function testGetException() |
|
| 108 | { |
|
| 109 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 110 | ||
| 111 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Stock\Standard' ) |
|
| 112 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'stock'] ) |
|
| 113 | ->setMethods( ['getItems'] ) |
|
| 114 | ->getMock(); |
|
| 115 | ||
| 116 | $object->expects( $this->once() )->method( 'getItems' ) |
|
| 117 | ->will( $this->throwException( new \Exception() ) ); |
|
| 118 | ||
| 119 | ||
| 120 | $response = $object->get( $this->view->request(), $this->view->response() ); |
|
| 121 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 122 | ||
| 123 | ||
| 124 | $this->assertEquals( 500, $response->getStatusCode() ); |
|
| 125 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 126 | } |
|
| 127 | } |
|
| @@ 121-140 (lines=20) @@ | ||
| 118 | } |
|
| 119 | ||
| 120 | ||
| 121 | public function testGetMShopException() |
|
| 122 | { |
|
| 123 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 124 | ||
| 125 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Locale\Standard' ) |
|
| 126 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'locale'] ) |
|
| 127 | ->setMethods( ['getItems'] ) |
|
| 128 | ->getMock(); |
|
| 129 | ||
| 130 | $object->expects( $this->once() )->method( 'getItems' ) |
|
| 131 | ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
| 132 | ||
| 133 | ||
| 134 | $response = $object->get( $this->view->request(), $this->view->response() ); |
|
| 135 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 136 | ||
| 137 | ||
| 138 | $this->assertEquals( 404, $response->getStatusCode() ); |
|
| 139 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 140 | } |
|
| 141 | ||
| 142 | ||
| 143 | public function testGetException() |
|
| @@ 143-162 (lines=20) @@ | ||
| 140 | } |
|
| 141 | ||
| 142 | ||
| 143 | public function testGetException() |
|
| 144 | { |
|
| 145 | $templatePaths = \TestHelperJapi::getTemplatePaths(); |
|
| 146 | ||
| 147 | $object = $this->getMockBuilder( '\Aimeos\Client\JsonApi\Locale\Standard' ) |
|
| 148 | ->setConstructorArgs( [$this->context, $this->view, $templatePaths, 'locale'] ) |
|
| 149 | ->setMethods( ['getItems'] ) |
|
| 150 | ->getMock(); |
|
| 151 | ||
| 152 | $object->expects( $this->once() )->method( 'getItems' ) |
|
| 153 | ->will( $this->throwException( new \Exception() ) ); |
|
| 154 | ||
| 155 | ||
| 156 | $response = $object->get( $this->view->request(), $this->view->response() ); |
|
| 157 | $result = json_decode( (string) $response->getBody(), true ); |
|
| 158 | ||
| 159 | ||
| 160 | $this->assertEquals( 500, $response->getStatusCode() ); |
|
| 161 | $this->assertArrayHasKey( 'errors', $result ); |
|
| 162 | } |
|
| 163 | } |
|