@@ -106,6 +106,7 @@ |
||
106 | 106 | * @param string $body Request body |
107 | 107 | * @param array &$header Variable which contains the HTTP headers and the new ones afterwards |
108 | 108 | * @param integer &$status Variable which contains the HTTP status afterwards |
109 | + * @param integer $status |
|
109 | 110 | * @return string Content for response body |
110 | 111 | */ |
111 | 112 | public function get( $body, array &$header, &$status ) |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param integer &$status Variable which contains the HTTP status afterwards |
109 | 109 | * @return string Content for response body |
110 | 110 | */ |
111 | - public function get( $body, array &$header, &$status ) |
|
111 | + public function get($body, array &$header, &$status) |
|
112 | 112 | { |
113 | 113 | /** admin/jsonadm/partials/locale/site/template-data |
114 | 114 | * Relative path to the data partial template file for the locale site client |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @since 2016.07 |
126 | 126 | * @category Developer |
127 | 127 | */ |
128 | - $this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/locale/site/template-data' ) ); |
|
128 | + $this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/locale/site/template-data')); |
|
129 | 129 | |
130 | - return parent::get( $body, $header, $status ); |
|
130 | + return parent::get($body, $header, $status); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | * @param array $include List of resource types that should be fetched |
139 | 139 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
140 | 140 | */ |
141 | - protected function getChildItems( array $items, array $include ) |
|
141 | + protected function getChildItems(array $items, array $include) |
|
142 | 142 | { |
143 | 143 | $list = array(); |
144 | 144 | |
145 | - if( in_array( 'locale/site', $include ) ) |
|
145 | + if (in_array('locale/site', $include)) |
|
146 | 146 | { |
147 | - foreach( $items as $item ) { |
|
148 | - $list = array_merge( $list, $item->getChildren() ); |
|
147 | + foreach ($items as $item) { |
|
148 | + $list = array_merge($list, $item->getChildren()); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -159,22 +159,22 @@ discard block |
||
159 | 159 | * @param \Aimeos\MW\View\Iface $view View instance |
160 | 160 | * @return \Aimeos\MW\View\Iface View instance with additional data assigned |
161 | 161 | */ |
162 | - protected function getItems( \Aimeos\MW\View\Iface $view ) |
|
162 | + protected function getItems(\Aimeos\MW\View\Iface $view) |
|
163 | 163 | { |
164 | - $include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : array() ); |
|
165 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale/site' ); |
|
166 | - $search = $this->initCriteria( $manager->createSearch(), $view->param() ); |
|
164 | + $include = (($include = $view->param('include')) !== null ? explode(',', $include) : array()); |
|
165 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale/site'); |
|
166 | + $search = $this->initCriteria($manager->createSearch(), $view->param()); |
|
167 | 167 | $total = 1; |
168 | 168 | |
169 | - if( ( $id = $view->param( 'id' ) ) == null ) |
|
169 | + if (($id = $view->param('id')) == null) |
|
170 | 170 | { |
171 | - $view->data = $manager->searchItems( $search, array(), $total ); |
|
172 | - $view->childItems = $this->getChildItems( $view->data, $include ); |
|
171 | + $view->data = $manager->searchItems($search, array(), $total); |
|
172 | + $view->childItems = $this->getChildItems($view->data, $include); |
|
173 | 173 | } |
174 | 174 | else |
175 | 175 | { |
176 | - $view->data = $manager->getTree( $id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search ); |
|
177 | - $view->childItems = $this->getChildItems( array( $view->data ), $include ); |
|
176 | + $view->data = $manager->getTree($id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search); |
|
177 | + $view->childItems = $this->getChildItems(array($view->data), $include); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $view->listItems = array(); |
@@ -192,32 +192,32 @@ discard block |
||
192 | 192 | * @param \stdClass $entry Object including "id" and "attributes" elements |
193 | 193 | * @return \Aimeos\MShop\Common\Item\Iface New or updated item |
194 | 194 | */ |
195 | - protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry ) |
|
195 | + protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry) |
|
196 | 196 | { |
197 | - $targetId = ( isset( $entry->targetid ) ? $entry->targetid : null ); |
|
198 | - $refId = ( isset( $entry->refid ) ? $entry->refid : null ); |
|
197 | + $targetId = (isset($entry->targetid) ? $entry->targetid : null); |
|
198 | + $refId = (isset($entry->refid) ? $entry->refid : null); |
|
199 | 199 | |
200 | - if( isset( $entry->id ) ) |
|
200 | + if (isset($entry->id)) |
|
201 | 201 | { |
202 | - $item = $manager->getItem( $entry->id ); |
|
203 | - $item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() ); |
|
204 | - $manager->saveItem( $item ); |
|
202 | + $item = $manager->getItem($entry->id); |
|
203 | + $item = $this->addItemData($manager, $item, $entry, $item->getResourceType()); |
|
204 | + $manager->saveItem($item); |
|
205 | 205 | |
206 | - if( isset( $entry->parentid ) && $targetId !== null ) { |
|
207 | - $manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId ); |
|
206 | + if (isset($entry->parentid) && $targetId !== null) { |
|
207 | + $manager->moveItem($item->getId(), $entry->parentid, $targetId, $refId); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | else |
211 | 211 | { |
212 | 212 | $item = $manager->createItem(); |
213 | - $item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() ); |
|
214 | - $manager->insertItem( $item, $targetId, $refId ); |
|
213 | + $item = $this->addItemData($manager, $item, $entry, $item->getResourceType()); |
|
214 | + $manager->insertItem($item, $targetId, $refId); |
|
215 | 215 | } |
216 | 216 | |
217 | - if( isset( $entry->relationships ) ) { |
|
218 | - $this->saveRelationships( $manager, $item, $entry->relationships ); |
|
217 | + if (isset($entry->relationships)) { |
|
218 | + $this->saveRelationships($manager, $item, $entry->relationships); |
|
219 | 219 | } |
220 | 220 | |
221 | - return $manager->getItem( $item->getId() ); |
|
221 | + return $manager->getItem($item->getId()); |
|
222 | 222 | } |
223 | 223 | } |
@@ -171,8 +171,7 @@ discard block |
||
171 | 171 | $view->data = $manager->searchItems( $search, array(), $total ); |
172 | 172 | $view->listItems = $this->getListItems( $view->data, $include ); |
173 | 173 | $view->childItems = $this->getChildItems( $view->data, $include ); |
174 | - } |
|
175 | - else |
|
174 | + } else |
|
176 | 175 | { |
177 | 176 | $view->data = $manager->getTree( $id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search ); |
178 | 177 | $view->listItems = $this->getListItems( array( $id => $view->data ), $include ); |
@@ -229,8 +228,7 @@ discard block |
||
229 | 228 | if( isset( $entry->parentid ) && $targetId !== null ) { |
230 | 229 | $manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId ); |
231 | 230 | } |
232 | - } |
|
233 | - else |
|
231 | + } else |
|
234 | 232 | { |
235 | 233 | $item = $manager->createItem(); |
236 | 234 | $item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() ); |
@@ -1,25 +1,25 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $options = 0; |
4 | -if( defined( 'JSON_PRETTY_PRINT' ) ) { |
|
4 | +if (defined('JSON_PRETTY_PRINT')) { |
|
5 | 5 | $options = JSON_PRETTY_PRINT; |
6 | 6 | } |
7 | 7 | |
8 | 8 | |
9 | -$build = function( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Locale\Item\Site\Iface $item, array $fields ) |
|
9 | +$build = function(\Aimeos\MW\View\Iface $view, \Aimeos\MShop\Locale\Item\Site\Iface $item, array $fields) |
|
10 | 10 | { |
11 | 11 | $id = $item->getId(); |
12 | 12 | $attributes = $item->toArray(); |
13 | 13 | $type = $item->getResourceType(); |
14 | - $params = array( 'resource' => $item->getResourceType(), 'id' => $id ); |
|
14 | + $params = array('resource' => $item->getResourceType(), 'id' => $id); |
|
15 | 15 | |
16 | - $target = $view->config( 'admin/jsonadm/url/target' ); |
|
17 | - $cntl = $view->config( 'admin/jsonadm/url/controller', 'jsonadm' ); |
|
18 | - $action = $view->config( 'admin/jsonadm/url/action', 'get' ); |
|
19 | - $config = $view->config( 'admin/jsonadm/url/config', array() ); |
|
16 | + $target = $view->config('admin/jsonadm/url/target'); |
|
17 | + $cntl = $view->config('admin/jsonadm/url/controller', 'jsonadm'); |
|
18 | + $action = $view->config('admin/jsonadm/url/action', 'get'); |
|
19 | + $config = $view->config('admin/jsonadm/url/config', array()); |
|
20 | 20 | |
21 | - if( isset( $fields[$type] ) ) { |
|
22 | - $attributes = array_intersect_key( $attributes, $fields[$type] ); |
|
21 | + if (isset($fields[$type])) { |
|
22 | + $attributes = array_intersect_key($attributes, $fields[$type]); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $result = array( |
@@ -27,41 +27,41 @@ discard block |
||
27 | 27 | 'type' => $type, |
28 | 28 | 'attributes' => $attributes, |
29 | 29 | 'links' => array( |
30 | - 'self' => $view->url( $target, $cntl, $action, $params, array(), $config ) |
|
30 | + 'self' => $view->url($target, $cntl, $action, $params, array(), $config) |
|
31 | 31 | ), |
32 | 32 | 'relationships' => array() |
33 | 33 | ); |
34 | 34 | |
35 | - foreach( $item->getChildren() as $childItem ) |
|
35 | + foreach ($item->getChildren() as $childItem) |
|
36 | 36 | { |
37 | 37 | $type = $childItem->getResourceType(); |
38 | - $result['relationships'][$type][] = array( 'data' => array( 'id' => $childItem->getId(), 'type' => $type ) ); |
|
38 | + $result['relationships'][$type][] = array('data' => array('id' => $childItem->getId(), 'type' => $type)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | return $result; |
42 | 42 | }; |
43 | 43 | |
44 | 44 | |
45 | -$fields = $this->param( 'fields', array() ); |
|
45 | +$fields = $this->param('fields', array()); |
|
46 | 46 | |
47 | -foreach( (array) $fields as $resource => $list ) { |
|
48 | - $fields[$resource] = array_flip( explode( ',', $list ) ); |
|
47 | +foreach ((array) $fields as $resource => $list) { |
|
48 | + $fields[$resource] = array_flip(explode(',', $list)); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | -$data = $this->get( 'data', array() ); |
|
52 | +$data = $this->get('data', array()); |
|
53 | 53 | |
54 | -if( is_array( $data ) ) |
|
54 | +if (is_array($data)) |
|
55 | 55 | { |
56 | 56 | $response = array(); |
57 | 57 | |
58 | - foreach( $data as $item ) { |
|
59 | - $response[] = $build( $this, $item, $fields ); |
|
58 | + foreach ($data as $item) { |
|
59 | + $response[] = $build($this, $item, $fields); |
|
60 | 60 | } |
61 | 61 | } |
62 | -elseif( $data !== null ) |
|
62 | +elseif ($data !== null) |
|
63 | 63 | { |
64 | - $response = $build( $this, $data, $fields ); |
|
64 | + $response = $build($this, $data, $fields); |
|
65 | 65 | } |
66 | 66 | else |
67 | 67 | { |
@@ -69,4 +69,4 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | -echo json_encode( $response, $options ); |
|
73 | 72 | \ No newline at end of file |
73 | +echo json_encode($response, $options); |
|
74 | 74 | \ No newline at end of file |
@@ -52,12 +52,10 @@ |
||
52 | 52 | foreach( $data as $item ) { |
53 | 53 | $response[] = $build( $item, $fields, $childItems ); |
54 | 54 | } |
55 | -} |
|
56 | -elseif( $data !== null ) |
|
55 | +} elseif( $data !== null ) |
|
57 | 56 | { |
58 | 57 | $response = $build( $data, $fields, $childItems ); |
59 | -} |
|
60 | -else |
|
58 | +} else |
|
61 | 59 | { |
62 | 60 | $response = null; |
63 | 61 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJadm::getContext(); |
23 | 23 | $this->view = $this->context->getView(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JsonAdm\Locale\Site\Standard( $this->context, $this->view, $templatePaths, 'locale/site' ); |
|
25 | + $this->object = new \Aimeos\Admin\JsonAdm\Locale\Site\Standard($this->context, $this->view, $templatePaths, 'locale/site'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -30,144 +30,144 @@ discard block |
||
30 | 30 | { |
31 | 31 | $params = array( |
32 | 32 | 'filter' => array( |
33 | - '==' => array( 'locale.site.code' => 'unittest' ) |
|
33 | + '==' => array('locale.site.code' => 'unittest') |
|
34 | 34 | ), |
35 | 35 | ); |
36 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
37 | - $this->view->addHelper( 'param', $helper ); |
|
36 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
37 | + $this->view->addHelper('param', $helper); |
|
38 | 38 | |
39 | 39 | $header = array(); |
40 | 40 | $status = 500; |
41 | 41 | |
42 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
42 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
43 | 43 | |
44 | - $this->assertEquals( 200, $status ); |
|
45 | - $this->assertEquals( 1, count( $header ) ); |
|
46 | - $this->assertEquals( 1, $result['meta']['total'] ); |
|
47 | - $this->assertEquals( 1, count( $result['data'] ) ); |
|
48 | - $this->assertEquals( 'locale/site', $result['data'][0]['type'] ); |
|
49 | - $this->assertEquals( 0, count( $result['included'] ) ); |
|
50 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
44 | + $this->assertEquals(200, $status); |
|
45 | + $this->assertEquals(1, count($header)); |
|
46 | + $this->assertEquals(1, $result['meta']['total']); |
|
47 | + $this->assertEquals(1, count($result['data'])); |
|
48 | + $this->assertEquals('locale/site', $result['data'][0]['type']); |
|
49 | + $this->assertEquals(0, count($result['included'])); |
|
50 | + $this->assertArrayNotHasKey('errors', $result); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | public function testGetTree() |
55 | 55 | { |
56 | 56 | $params = array( |
57 | - 'id' => $this->getSiteItem( 'unittest' )->getId(), |
|
57 | + 'id' => $this->getSiteItem('unittest')->getId(), |
|
58 | 58 | 'filter' => array( |
59 | - '==' => array( 'locale.status' => 0 ) |
|
59 | + '==' => array('locale.status' => 0) |
|
60 | 60 | ), |
61 | 61 | 'include' => 'locale/site' |
62 | 62 | ); |
63 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
64 | - $this->view->addHelper( 'param', $helper ); |
|
63 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
64 | + $this->view->addHelper('param', $helper); |
|
65 | 65 | |
66 | 66 | $header = array(); |
67 | 67 | $status = 500; |
68 | 68 | |
69 | - $result = json_decode( $this->object->get( '', $header, $status ), true ); |
|
69 | + $result = json_decode($this->object->get('', $header, $status), true); |
|
70 | 70 | |
71 | - $this->assertEquals( 200, $status ); |
|
72 | - $this->assertEquals( 1, count( $header ) ); |
|
73 | - $this->assertEquals( 1, $result['meta']['total'] ); |
|
74 | - $this->assertEquals( 'locale/site', $result['data']['type'] ); |
|
75 | - $this->assertEquals( 0, count( $result['included'] ) ); |
|
76 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
71 | + $this->assertEquals(200, $status); |
|
72 | + $this->assertEquals(1, count($header)); |
|
73 | + $this->assertEquals(1, $result['meta']['total']); |
|
74 | + $this->assertEquals('locale/site', $result['data']['type']); |
|
75 | + $this->assertEquals(0, count($result['included'])); |
|
76 | + $this->assertArrayNotHasKey('errors', $result); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
80 | 80 | public function testPatch() |
81 | 81 | { |
82 | - $stub = $this->getSiteMock( array( 'getItem', 'moveItem', 'saveItem' ) ); |
|
82 | + $stub = $this->getSiteMock(array('getItem', 'moveItem', 'saveItem')); |
|
83 | 83 | $item = $stub->createItem(); |
84 | 84 | |
85 | - $stub->expects( $this->once() )->method( 'moveItem' ); |
|
86 | - $stub->expects( $this->once() )->method( 'saveItem' ); |
|
87 | - $stub->expects( $this->exactly( 2 ) )->method( 'getItem' ) // 2x due to decorator |
|
88 | - ->will( $this->returnValue( $item ) ); |
|
85 | + $stub->expects($this->once())->method('moveItem'); |
|
86 | + $stub->expects($this->once())->method('saveItem'); |
|
87 | + $stub->expects($this->exactly(2))->method('getItem') // 2x due to decorator |
|
88 | + ->will($this->returnValue($item)); |
|
89 | 89 | |
90 | 90 | |
91 | - $params = array( 'id' => '-1' ); |
|
92 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params ); |
|
93 | - $this->view->addHelper( 'param', $helper ); |
|
91 | + $params = array('id' => '-1'); |
|
92 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params); |
|
93 | + $this->view->addHelper('param', $helper); |
|
94 | 94 | |
95 | 95 | $body = '{"data": {"parentid": "1", "targetid": 2, "type": "locale/site", "attributes": {"locale.site.label": "test"}}}'; |
96 | 96 | $header = array(); |
97 | 97 | $status = 500; |
98 | 98 | |
99 | - $result = json_decode( $this->object->patch( $body, $header, $status ), true ); |
|
99 | + $result = json_decode($this->object->patch($body, $header, $status), true); |
|
100 | 100 | |
101 | - $this->assertEquals( 200, $status ); |
|
102 | - $this->assertEquals( 1, count( $header ) ); |
|
103 | - $this->assertEquals( 1, $result['meta']['total'] ); |
|
104 | - $this->assertArrayHasKey( 'data', $result ); |
|
105 | - $this->assertEquals( 'locale/site', $result['data']['type'] ); |
|
106 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
107 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
101 | + $this->assertEquals(200, $status); |
|
102 | + $this->assertEquals(1, count($header)); |
|
103 | + $this->assertEquals(1, $result['meta']['total']); |
|
104 | + $this->assertArrayHasKey('data', $result); |
|
105 | + $this->assertEquals('locale/site', $result['data']['type']); |
|
106 | + $this->assertArrayNotHasKey('included', $result); |
|
107 | + $this->assertArrayNotHasKey('errors', $result); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | 111 | public function testPost() |
112 | 112 | { |
113 | - $stub = $this->getSiteMock( array( 'getItem', 'insertItem' ) ); |
|
113 | + $stub = $this->getSiteMock(array('getItem', 'insertItem')); |
|
114 | 114 | $item = $stub->createItem(); |
115 | 115 | |
116 | - $stub->expects( $this->any() )->method( 'getItem' ) |
|
117 | - ->will( $this->returnValue( $item ) ); |
|
118 | - $stub->expects( $this->once() )->method( 'insertItem' ); |
|
116 | + $stub->expects($this->any())->method('getItem') |
|
117 | + ->will($this->returnValue($item)); |
|
118 | + $stub->expects($this->once())->method('insertItem'); |
|
119 | 119 | |
120 | 120 | |
121 | 121 | $body = '{"data": {"type": "locale/site", "attributes": {"locale.site.code": "unittest", "locale.site.label": "Unit test"}}}'; |
122 | 122 | $header = array(); |
123 | 123 | $status = 500; |
124 | 124 | |
125 | - $result = json_decode( $this->object->post( $body, $header, $status ), true ); |
|
125 | + $result = json_decode($this->object->post($body, $header, $status), true); |
|
126 | 126 | |
127 | - $this->assertEquals( 201, $status ); |
|
128 | - $this->assertEquals( 1, count( $header ) ); |
|
129 | - $this->assertEquals( 1, $result['meta']['total'] ); |
|
130 | - $this->assertArrayHasKey( 'data', $result ); |
|
131 | - $this->assertEquals( 'locale/site', $result['data']['type'] ); |
|
132 | - $this->assertArrayNotHasKey( 'included', $result ); |
|
133 | - $this->assertArrayNotHasKey( 'errors', $result ); |
|
127 | + $this->assertEquals(201, $status); |
|
128 | + $this->assertEquals(1, count($header)); |
|
129 | + $this->assertEquals(1, $result['meta']['total']); |
|
130 | + $this->assertArrayHasKey('data', $result); |
|
131 | + $this->assertEquals('locale/site', $result['data']['type']); |
|
132 | + $this->assertArrayNotHasKey('included', $result); |
|
133 | + $this->assertArrayNotHasKey('errors', $result); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
137 | - protected function getSiteItem( $code ) |
|
137 | + protected function getSiteItem($code) |
|
138 | 138 | { |
139 | - $manager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $this->context )->getSubManager( 'site' ); |
|
139 | + $manager = \Aimeos\MShop\Locale\Manager\Factory::createManager($this->context)->getSubManager('site'); |
|
140 | 140 | $search = $manager->createSearch(); |
141 | - $search->setConditions( $search->compare( '==', 'locale.site.code', $code ) ); |
|
142 | - $items = $manager->searchItems( $search ); |
|
141 | + $search->setConditions($search->compare('==', 'locale.site.code', $code)); |
|
142 | + $items = $manager->searchItems($search); |
|
143 | 143 | |
144 | - if( ( $item = reset( $items ) ) === false ) { |
|
145 | - throw new \Exception( sprintf( 'No locale site item with code "%1$s" found', $code ) ); |
|
144 | + if (($item = reset($items)) === false) { |
|
145 | + throw new \Exception(sprintf('No locale site item with code "%1$s" found', $code)); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return $item; |
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | - protected function getSiteMock( array $methods ) |
|
152 | + protected function getSiteMock(array $methods) |
|
153 | 153 | { |
154 | 154 | $name = 'ClientJsonAdmStandard'; |
155 | - $this->context->getConfig()->set( 'mshop/locale/manager/name', $name ); |
|
155 | + $this->context->getConfig()->set('mshop/locale/manager/name', $name); |
|
156 | 156 | |
157 | - $stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Locale\\Manager\\Standard' ) |
|
158 | - ->setConstructorArgs( array( $this->context ) ) |
|
159 | - ->setMethods( array( 'getSubManager' ) ) |
|
157 | + $stub = $this->getMockBuilder('\\Aimeos\\MShop\\Locale\\Manager\\Standard') |
|
158 | + ->setConstructorArgs(array($this->context)) |
|
159 | + ->setMethods(array('getSubManager')) |
|
160 | 160 | ->getMock(); |
161 | 161 | |
162 | - $siteStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Locale\\Manager\\Site\\Standard' ) |
|
163 | - ->setConstructorArgs( array( $this->context ) ) |
|
164 | - ->setMethods( $methods ) |
|
162 | + $siteStub = $this->getMockBuilder('\\Aimeos\\MShop\\Locale\\Manager\\Site\\Standard') |
|
163 | + ->setConstructorArgs(array($this->context)) |
|
164 | + ->setMethods($methods) |
|
165 | 165 | ->getMock(); |
166 | 166 | |
167 | - $stub->expects( $this->once() )->method( 'getSubManager' ) |
|
168 | - ->will( $this->returnValue( $siteStub ) ); |
|
167 | + $stub->expects($this->once())->method('getSubManager') |
|
168 | + ->will($this->returnValue($siteStub)); |
|
169 | 169 | |
170 | - \Aimeos\MShop\Locale\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Locale\\Manager\\' . $name, $stub ); |
|
170 | + \Aimeos\MShop\Locale\Manager\Factory::injectManager('\\Aimeos\\MShop\\Locale\\Manager\\' . $name, $stub); |
|
171 | 171 | |
172 | 172 | return $siteStub; |
173 | 173 | } |