@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Menu\View\Helper; |
4 | 4 | |
5 | 5 | use Zend\View\Helper\AbstractHelper; |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __invoke($menuItem) |
33 | 33 | { |
34 | - if ($menuItem['href']) { |
|
35 | - return strpos($menuItem['href'], 'http') === 0 ? $menuItem['href'] : '/' . $menuItem['href']; |
|
36 | - } elseif ($menuItem['page_slug']) { |
|
37 | - return $this->url->__invoke('page', ['url_slug' => $menuItem['page_slug']]); |
|
38 | - } elseif ($menuItem['category_slug']) { |
|
39 | - return $this->url->__invoke('category', ['category' => $menuItem['category_slug']]); |
|
34 | + if ($menuItem[ 'href' ]) { |
|
35 | + return strpos($menuItem[ 'href' ], 'http') === 0 ? $menuItem[ 'href' ] : '/' . $menuItem[ 'href' ]; |
|
36 | + } elseif ($menuItem[ 'page_slug' ]) { |
|
37 | + return $this->url->__invoke('page', [ 'url_slug' => $menuItem[ 'page_slug' ] ]); |
|
38 | + } elseif ($menuItem[ 'category_slug' ]) { |
|
39 | + return $this->url->__invoke('category', [ 'category' => $menuItem[ 'category_slug' ] ]); |
|
40 | 40 | } else { |
41 | 41 | return '#'; |
42 | 42 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Menu\View\Helper; |
4 | 4 | |
5 | 5 | use Menu\Service\MenuService; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Menu\View\Helper; |
4 | 4 | |
5 | 5 | use Interop\Container\ContainerInterface; |
@@ -28,26 +28,26 @@ discard block |
||
28 | 28 | private function unflattenArray(array $flatArray) |
29 | 29 | { |
30 | 30 | $flatArray = array_reverse($flatArray); |
31 | - $refs = []; |
|
32 | - $result = []; |
|
31 | + $refs = [ ]; |
|
32 | + $result = [ ]; |
|
33 | 33 | |
34 | 34 | while (count($flatArray) > 0) { |
35 | 35 | for ($i = count($flatArray) - 1; $i >= 0; $i--) { |
36 | - if (!isset($flatArray[$i]['children'])) { |
|
37 | - $flatArray[$i]['children'] = []; |
|
36 | + if (!isset($flatArray[ $i ][ 'children' ])) { |
|
37 | + $flatArray[ $i ][ 'children' ] = [ ]; |
|
38 | 38 | } |
39 | 39 | |
40 | - if (!$flatArray[$i]["parent_id"]) { |
|
41 | - $result[$flatArray[$i]["menu_id"]] = $flatArray[$i]; |
|
42 | - $refs[$flatArray[$i]["menu_id"]] = &$result[$flatArray[$i]["menu_id"]]; |
|
43 | - unset($flatArray[$i]); |
|
40 | + if (!$flatArray[ $i ][ "parent_id" ]) { |
|
41 | + $result[ $flatArray[ $i ][ "menu_id" ] ] = $flatArray[ $i ]; |
|
42 | + $refs[ $flatArray[ $i ][ "menu_id" ] ] = &$result[ $flatArray[ $i ][ "menu_id" ] ]; |
|
43 | + unset($flatArray[ $i ]); |
|
44 | 44 | $flatArray = array_values($flatArray); |
45 | - } elseif ($flatArray[$i]["parent_id"] != 0) { |
|
46 | - if (array_key_exists($flatArray[$i]["parent_id"], $refs)) { |
|
47 | - $o = $flatArray[$i]; |
|
48 | - $refs[$flatArray[$i]["menu_id"]] = $o; |
|
49 | - $refs[$flatArray[$i]["parent_id"]]["children"][] = &$refs[$flatArray[$i]["menu_id"]]; |
|
50 | - unset($flatArray[$i]); |
|
45 | + } elseif ($flatArray[ $i ][ "parent_id" ] != 0) { |
|
46 | + if (array_key_exists($flatArray[ $i ][ "parent_id" ], $refs)) { |
|
47 | + $o = $flatArray[ $i ]; |
|
48 | + $refs[ $flatArray[ $i ][ "menu_id" ] ] = $o; |
|
49 | + $refs[ $flatArray[ $i ][ "parent_id" ] ][ "children" ][ ] = &$refs[ $flatArray[ $i ][ "menu_id" ] ]; |
|
50 | + unset($flatArray[ $i ]); |
|
51 | 51 | $flatArray = array_values($flatArray); |
52 | 52 | } |
53 | 53 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->pageService = $pageService; |
70 | 70 | } |
71 | 71 | |
72 | - public function getNestedAll($isActive = null, $filter = []) |
|
72 | + public function getNestedAll($isActive = null, $filter = [ ]) |
|
73 | 73 | { |
74 | 74 | $items = $this->menuMapper->selectAll($isActive, $filter)->toArray(); |
75 | 75 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | { |
86 | 86 | $data = $this->filterMenuItem($data); |
87 | 87 | |
88 | - $data['menu_id'] = Uuid::uuid1()->toString(); |
|
89 | - $data['menu_uuid'] = (new MysqlUuid($data['menu_id']))->toFormat(new Binary); |
|
88 | + $data[ 'menu_id' ] = Uuid::uuid1()->toString(); |
|
89 | + $data[ 'menu_uuid' ] = (new MysqlUuid($data[ 'menu_id' ]))->toFormat(new Binary); |
|
90 | 90 | |
91 | 91 | return $this->menuMapper->insertMenuItem($data); |
92 | 92 | } |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | |
101 | 101 | public function delete($id) |
102 | 102 | { |
103 | - $children = $this->menuMapper->select(['parent_id' => $id]); |
|
103 | + $children = $this->menuMapper->select([ 'parent_id' => $id ]); |
|
104 | 104 | |
105 | 105 | if ($children->count()) { |
106 | 106 | throw new \Exception('This Menu Item has child items', 400); |
107 | 107 | } |
108 | 108 | |
109 | - return $this->menuMapper->delete(['menu_id' => $id]); |
|
109 | + return $this->menuMapper->delete([ 'menu_id' => $id ]); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | public function getForSelect() |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | { |
139 | 139 | foreach ($children as $v) { |
140 | 140 | if (isset($v->children)) { |
141 | - $this->menuMapper->update(['order_no' => $orderNo++, 'parent_id' => $parentId], ['menu_id' => $v->id]); |
|
141 | + $this->menuMapper->update([ 'order_no' => $orderNo++, 'parent_id' => $parentId ], [ 'menu_id' => $v->id ]); |
|
142 | 142 | $this->updateLevel($v->children, $orderNo, $v->id); |
143 | 143 | } else { |
144 | - $this->menuMapper->update(['order_no' => $orderNo++, 'parent_id' => $parentId], ['menu_id' => $v->id]); |
|
144 | + $this->menuMapper->update([ 'order_no' => $orderNo++, 'parent_id' => $parentId ], [ 'menu_id' => $v->id ]); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | } |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | throw new FilterException($filter->getMessages()); |
155 | 155 | } |
156 | 156 | |
157 | - if (count(array_filter([$data['page_id'], $data['category_id'], $data['href']])) > 1) { |
|
157 | + if (count(array_filter([ $data[ 'page_id' ], $data[ 'category_id' ], $data[ 'href' ] ])) > 1) { |
|
158 | 158 | throw new \Exception('You need to set only one link. Post, Category or Href.'); |
159 | 159 | } |
160 | 160 | |
161 | 161 | $data = $filter->getValues(); |
162 | 162 | |
163 | - if ($data['page_id']) { |
|
164 | - $page = $this->pageService->getPage($data['page_id']); |
|
165 | - $data['page_uuid'] = $page->getPageUuid(); |
|
166 | - $data['category_uuid'] = null; |
|
167 | - } elseif ($data['category_id']) { |
|
163 | + if ($data[ 'page_id' ]) { |
|
164 | + $page = $this->pageService->getPage($data[ 'page_id' ]); |
|
165 | + $data[ 'page_uuid' ] = $page->getPageUuid(); |
|
166 | + $data[ 'category_uuid' ] = null; |
|
167 | + } elseif ($data[ 'category_id' ]) { |
|
168 | 168 | $category |
169 | - = $this->categoryService->getCategory($data['category_id']); |
|
170 | - $data['category_uuid'] = $category->category_uuid; |
|
171 | - $data['page_uuid'] = null; |
|
169 | + = $this->categoryService->getCategory($data[ 'category_id' ]); |
|
170 | + $data[ 'category_uuid' ] = $category->category_uuid; |
|
171 | + $data[ 'page_uuid' ] = null; |
|
172 | 172 | } else { |
173 | - $data['page_uuid'] = null; |
|
174 | - $data['category_uuid'] = null; |
|
173 | + $data[ 'page_uuid' ] = null; |
|
174 | + $data[ 'category_uuid' ] = null; |
|
175 | 175 | } |
176 | 176 | |
177 | - unset($data['page_id'], $data['category_id']); |
|
177 | + unset($data[ 'page_id' ], $data[ 'category_id' ]); |
|
178 | 178 | |
179 | 179 | return $data; |
180 | 180 | } |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | [ |
28 | 28 | 'name' => 'title', |
29 | 29 | 'required' => true, |
30 | - 'filters' => [['name' => 'StripTags'], ['name' => 'StringTrim']], |
|
30 | + 'filters' => [ [ 'name' => 'StripTags' ], [ 'name' => 'StringTrim' ] ], |
|
31 | 31 | 'validators' => [ |
32 | - ['name' => 'NotEmpty'], |
|
33 | - ['name' => 'StringLength', 'options' => ['max' => '255']], |
|
32 | + [ 'name' => 'NotEmpty' ], |
|
33 | + [ 'name' => 'StringLength', 'options' => [ 'max' => '255' ] ], |
|
34 | 34 | ], |
35 | 35 | ] |
36 | 36 | ); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | [ |
40 | 40 | 'name' => 'href', |
41 | 41 | 'required' => false, |
42 | - 'filters' => [['name' => 'StripTags'], ['name' => 'StringTrim']] |
|
42 | + 'filters' => [ [ 'name' => 'StripTags' ], [ 'name' => 'StringTrim' ] ] |
|
43 | 43 | ] |
44 | 44 | ); |
45 | 45 | |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | [ |
48 | 48 | 'name' => 'page_id', |
49 | 49 | 'required' => false, |
50 | - 'filters' => [['name' => 'Null']], |
|
50 | + 'filters' => [ [ 'name' => 'Null' ] ], |
|
51 | 51 | 'validators' => [ |
52 | 52 | [ |
53 | 53 | 'name' => RecordExists::class, |
54 | - 'options' => ['table' => 'page', 'field' => 'page_id', 'adapter' => $this->db] |
|
54 | + 'options' => [ 'table' => 'page', 'field' => 'page_id', 'adapter' => $this->db ] |
|
55 | 55 | ] |
56 | 56 | ] |
57 | 57 | ] |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | [ |
62 | 62 | 'name' => 'category_id', |
63 | 63 | 'required' => false, |
64 | - 'filters' => [['name' => 'Null']], |
|
64 | + 'filters' => [ [ 'name' => 'Null' ] ], |
|
65 | 65 | 'validators' => [ |
66 | 66 | [ |
67 | 67 | 'name' => RecordExists::class, |
68 | - 'options' => ['table' => 'category', 'field' => 'category_id', 'adapter' => $this->db] |
|
68 | + 'options' => [ 'table' => 'category', 'field' => 'category_id', 'adapter' => $this->db ] |
|
69 | 69 | ] |
70 | 70 | ] |
71 | 71 | ] |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | [ |
76 | 76 | 'name' => 'is_active', |
77 | 77 | 'required' => false, |
78 | - 'filters' => [['name' => 'Boolean']] |
|
78 | + 'filters' => [ [ 'name' => 'Boolean' ] ] |
|
79 | 79 | ] |
80 | 80 | ); |
81 | 81 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | [ |
84 | 84 | 'name' => 'is_in_header', |
85 | 85 | 'required' => false, |
86 | - 'filters' => [['name' => 'Boolean']] |
|
86 | + 'filters' => [ [ 'name' => 'Boolean' ] ] |
|
87 | 87 | ] |
88 | 88 | ); |
89 | 89 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | [ |
92 | 92 | 'name' => 'is_in_footer', |
93 | 93 | 'required' => false, |
94 | - 'filters' => [['name' => 'Boolean']] |
|
94 | + 'filters' => [ [ 'name' => 'Boolean' ] ] |
|
95 | 95 | ] |
96 | 96 | ); |
97 | 97 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | [ |
100 | 100 | 'name' => 'is_in_side', |
101 | 101 | 'required' => false, |
102 | - 'filters' => [['name' => 'Boolean']] |
|
102 | + 'filters' => [ [ 'name' => 'Boolean' ] ] |
|
103 | 103 | ] |
104 | 104 | ); |
105 | 105 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Menu\Factory\Controller; |
4 | 4 | |
5 | 5 | use Menu\Controller\IndexController; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Menu\Factory\Service; |
4 | 4 | |
5 | 5 | use Interop\Container\ContainerInterface; |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | ->method('createStatement') |
33 | 33 | ->willReturn($statementMock); |
34 | 34 | $adapterMock = $this->getMockBuilder(\Zend\Db\Adapter\Adapter::class) |
35 | - ->setConstructorArgs([$driverMock]) |
|
35 | + ->setConstructorArgs([ $driverMock ]) |
|
36 | 36 | ->getMockForAbstractClass(); |
37 | 37 | |
38 | 38 | $menuMapper = new \Menu\Mapper\MenuMapper(); |
39 | 39 | $menuMapper->setDbAdapter($adapterMock); |
40 | 40 | $menuMapper->initialize(); |
41 | - static::assertInstanceOf(\Zend\Db\ResultSet\ResultSet::class, $menuMapper->selectAll(true, ['is_in_header' => 1])); |
|
41 | + static::assertInstanceOf(\Zend\Db\ResultSet\ResultSet::class, $menuMapper->selectAll(true, [ 'is_in_header' => 1 ])); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function testSelectAllWithFooterFilterShouldReturnSelectInstance() |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | ->method('createStatement') |
58 | 58 | ->willReturn($statementMock); |
59 | 59 | $adapterMock = $this->getMockBuilder(\Zend\Db\Adapter\Adapter::class) |
60 | - ->setConstructorArgs([$driverMock]) |
|
60 | + ->setConstructorArgs([ $driverMock ]) |
|
61 | 61 | ->getMockForAbstractClass(); |
62 | 62 | |
63 | 63 | $menuMapper = new \Menu\Mapper\MenuMapper(); |
64 | 64 | $menuMapper->setDbAdapter($adapterMock); |
65 | 65 | $menuMapper->initialize(); |
66 | - static::assertInstanceOf(\Zend\Db\ResultSet\ResultSet::class, $menuMapper->selectAll(true, ['is_in_footer' => 1])); |
|
66 | + static::assertInstanceOf(\Zend\Db\ResultSet\ResultSet::class, $menuMapper->selectAll(true, [ 'is_in_footer' => 1 ])); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function testSelectAllWithSideFilterShouldReturnSelectInstance() |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | ->method('createStatement') |
83 | 83 | ->willReturn($statementMock); |
84 | 84 | $adapterMock = $this->getMockBuilder(\Zend\Db\Adapter\Adapter::class) |
85 | - ->setConstructorArgs([$driverMock]) |
|
85 | + ->setConstructorArgs([ $driverMock ]) |
|
86 | 86 | ->getMockForAbstractClass(); |
87 | 87 | |
88 | 88 | $menuMapper = new \Menu\Mapper\MenuMapper(); |
89 | 89 | $menuMapper->setDbAdapter($adapterMock); |
90 | 90 | $menuMapper->initialize(); |
91 | - static::assertInstanceOf(\Zend\Db\ResultSet\ResultSet::class, $menuMapper->selectAll(true, ['is_in_side' => 1])); |
|
91 | + static::assertInstanceOf(\Zend\Db\ResultSet\ResultSet::class, $menuMapper->selectAll(true, [ 'is_in_side' => 1 ])); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | // public function testInsertmenuItemShouldReturnId() |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | ->disableOriginalConstructor() |
13 | 13 | ->getMock(); |
14 | 14 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
15 | - ->setMethods(['selectAll', 'toArray']) |
|
15 | + ->setMethods([ 'selectAll', 'toArray' ]) |
|
16 | 16 | ->disableOriginalConstructor() |
17 | 17 | ->getMock(); |
18 | 18 | $menuMapper->expects(static::once()) |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | ->willReturnSelf(); |
21 | 21 | $menuMapper->expects(static::once()) |
22 | 22 | ->method('toArray') |
23 | - ->willReturn([]); |
|
23 | + ->willReturn([ ]); |
|
24 | 24 | $categoryService = $this->getMockBuilder(\Category\Service\CategoryService::class) |
25 | 25 | ->disableOriginalConstructor() |
26 | 26 | ->getMock(); |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | ->disableOriginalConstructor() |
39 | 39 | ->getMock(); |
40 | 40 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
41 | - ->setMethods(['get']) |
|
41 | + ->setMethods([ 'get' ]) |
|
42 | 42 | ->disableOriginalConstructor() |
43 | 43 | ->getMock(); |
44 | 44 | $menuMapper->expects(static::once()) |
45 | 45 | ->method('get') |
46 | - ->willReturn([]); |
|
46 | + ->willReturn([ ]); |
|
47 | 47 | $categoryService = $this->getMockBuilder(\Category\Service\CategoryService::class) |
48 | 48 | ->disableOriginalConstructor() |
49 | 49 | ->getMock(); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function testAddMenuItemWithPageIdShouldReturnTrue() |
59 | 59 | { |
60 | 60 | $menuFilter = $this->getMockBuilder(\Menu\Filter\MenuFilter::class) |
61 | - ->setMethods(['getInputFilter', 'setData', 'isValid', 'getValues']) |
|
61 | + ->setMethods([ 'getInputFilter', 'setData', 'isValid', 'getValues' ]) |
|
62 | 62 | ->disableOriginalConstructor() |
63 | 63 | ->getMock(); |
64 | 64 | $menuFilter->expects(static::once()) |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | ->willReturn(true); |
73 | 73 | $menuFilter->expects(static::once()) |
74 | 74 | ->method('getValues') |
75 | - ->willReturn(['page_id' => 1, 'category_id' => false, 'href' => false]); |
|
75 | + ->willReturn([ 'page_id' => 1, 'category_id' => false, 'href' => false ]); |
|
76 | 76 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
77 | - ->setMethods(['insertMenuItem', 'get']) |
|
77 | + ->setMethods([ 'insertMenuItem', 'get' ]) |
|
78 | 78 | ->disableOriginalConstructor() |
79 | 79 | ->getMock(); |
80 | 80 | $menuMapper->expects(static::once()) |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ->disableOriginalConstructor() |
85 | 85 | ->getMock(); |
86 | 86 | $pageService = $this->getMockBuilder(\Page\Service\PageService::class) |
87 | - ->setMethods(['getPage']) |
|
87 | + ->setMethods([ 'getPage' ]) |
|
88 | 88 | ->disableOriginalConstructor() |
89 | 89 | ->getMock(); |
90 | 90 | $pageService->expects(static::once()) |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | ->willReturn(new \Page\Entity\Page()); |
93 | 93 | $menuService = new \Menu\Service\MenuService($menuMapper, $menuFilter, $categoryService, $pageService); |
94 | 94 | |
95 | - static::assertSame(true, $menuService->addMenuItem(['page_id' => 1, 'category_id' => false, 'href' => false])); |
|
95 | + static::assertSame(true, $menuService->addMenuItem([ 'page_id' => 1, 'category_id' => false, 'href' => false ])); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | public function testAddMenuItemWithCategoryIdShouldReturnTrue() |
99 | 99 | { |
100 | 100 | $menuFilter = $this->getMockBuilder(\Menu\Filter\MenuFilter::class) |
101 | - ->setMethods(['getInputFilter', 'setData', 'isValid', 'getValues']) |
|
101 | + ->setMethods([ 'getInputFilter', 'setData', 'isValid', 'getValues' ]) |
|
102 | 102 | ->disableOriginalConstructor() |
103 | 103 | ->getMock(); |
104 | 104 | $menuFilter->expects(static::once()) |
@@ -112,27 +112,27 @@ discard block |
||
112 | 112 | ->willReturn(true); |
113 | 113 | $menuFilter->expects(static::once()) |
114 | 114 | ->method('getValues') |
115 | - ->willReturn(['page_id' => false, 'category_id' => 1, 'href' => false]); |
|
115 | + ->willReturn([ 'page_id' => false, 'category_id' => 1, 'href' => false ]); |
|
116 | 116 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
117 | - ->setMethods(['insertMenuItem', 'get']) |
|
117 | + ->setMethods([ 'insertMenuItem', 'get' ]) |
|
118 | 118 | ->disableOriginalConstructor() |
119 | 119 | ->getMock(); |
120 | 120 | $menuMapper->expects(static::once()) |
121 | 121 | ->method('insertMenuItem') |
122 | 122 | ->willReturn(true); |
123 | 123 | $categoryService = $this->getMockBuilder(\Category\Service\CategoryService::class) |
124 | - ->setMethods(['getCategory']) |
|
124 | + ->setMethods([ 'getCategory' ]) |
|
125 | 125 | ->disableOriginalConstructor() |
126 | 126 | ->getMock(); |
127 | 127 | $categoryService->expects(static::once()) |
128 | 128 | ->method('getCategory') |
129 | - ->willReturn(new ArrayObject(['category_uuid' => 'test'])); |
|
129 | + ->willReturn(new ArrayObject([ 'category_uuid' => 'test' ])); |
|
130 | 130 | $pageService = $this->getMockBuilder(\Page\Service\PageService::class) |
131 | 131 | ->disableOriginalConstructor() |
132 | 132 | ->getMock(); |
133 | 133 | $menuService = new \Menu\Service\MenuService($menuMapper, $menuFilter, $categoryService, $pageService); |
134 | 134 | |
135 | - static::assertSame(true, $menuService->addMenuItem(['page_id' => 1, 'category_id' => false, 'href' => false])); |
|
135 | + static::assertSame(true, $menuService->addMenuItem([ 'page_id' => 1, 'category_id' => false, 'href' => false ])); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public function testAddMenuItemWithCategoryIdShouldThrowFilterException() |
143 | 143 | { |
144 | 144 | $menuFilter = $this->getMockBuilder(\Menu\Filter\MenuFilter::class) |
145 | - ->setMethods(['getInputFilter', 'setData', 'isValid', 'getMessages']) |
|
145 | + ->setMethods([ 'getInputFilter', 'setData', 'isValid', 'getMessages' ]) |
|
146 | 146 | ->disableOriginalConstructor() |
147 | 147 | ->getMock(); |
148 | 148 | $menuFilter->expects(static::once()) |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | ->willReturn(false); |
157 | 157 | $menuFilter->expects(static::once()) |
158 | 158 | ->method('getMessages') |
159 | - ->willReturn(['test error']); |
|
159 | + ->willReturn([ 'test error' ]); |
|
160 | 160 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
161 | - ->setMethods(['get']) |
|
161 | + ->setMethods([ 'get' ]) |
|
162 | 162 | ->disableOriginalConstructor() |
163 | 163 | ->getMock(); |
164 | 164 | $categoryService = $this->getMockBuilder(\Category\Service\CategoryService::class) |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | ->getMock(); |
170 | 170 | $menuService = new \Menu\Service\MenuService($menuMapper, $menuFilter, $categoryService, $pageService); |
171 | 171 | |
172 | - static::assertSame(true, $menuService->addMenuItem(['page_id' => 1, 'category_id' => false, 'href' => false])); |
|
172 | + static::assertSame(true, $menuService->addMenuItem([ 'page_id' => 1, 'category_id' => false, 'href' => false ])); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | public function testAddMenuItemWithCategoryIdShouldThrowException() |
180 | 180 | { |
181 | 181 | $menuFilter = $this->getMockBuilder(\Menu\Filter\MenuFilter::class) |
182 | - ->setMethods(['getInputFilter', 'setData', 'isValid']) |
|
182 | + ->setMethods([ 'getInputFilter', 'setData', 'isValid' ]) |
|
183 | 183 | ->disableOriginalConstructor() |
184 | 184 | ->getMock(); |
185 | 185 | $menuFilter->expects(static::once()) |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | ->method('isValid') |
193 | 193 | ->willReturn(true); |
194 | 194 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
195 | - ->setMethods(['get']) |
|
195 | + ->setMethods([ 'get' ]) |
|
196 | 196 | ->disableOriginalConstructor() |
197 | 197 | ->getMock(); |
198 | 198 | $categoryService = $this->getMockBuilder(\Category\Service\CategoryService::class) |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | ->getMock(); |
204 | 204 | $menuService = new \Menu\Service\MenuService($menuMapper, $menuFilter, $categoryService, $pageService); |
205 | 205 | |
206 | - static::assertSame(true, $menuService->addMenuItem(['page_id' => 1, 'category_id' => 1, 'href' => 1])); |
|
206 | + static::assertSame(true, $menuService->addMenuItem([ 'page_id' => 1, 'category_id' => 1, 'href' => 1 ])); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | public function testAddMenuItemWithHrefShouldReturnTrue() |
210 | 210 | { |
211 | 211 | $menuFilter = $this->getMockBuilder(\Menu\Filter\MenuFilter::class) |
212 | - ->setMethods(['getInputFilter', 'setData', 'isValid', 'getValues']) |
|
212 | + ->setMethods([ 'getInputFilter', 'setData', 'isValid', 'getValues' ]) |
|
213 | 213 | ->disableOriginalConstructor() |
214 | 214 | ->getMock(); |
215 | 215 | $menuFilter->expects(static::once()) |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | ->willReturn(true); |
224 | 224 | $menuFilter->expects(static::once()) |
225 | 225 | ->method('getValues') |
226 | - ->willReturn(['page_id' => false, 'category_id' => false, 'href' => 'test']); |
|
226 | + ->willReturn([ 'page_id' => false, 'category_id' => false, 'href' => 'test' ]); |
|
227 | 227 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
228 | - ->setMethods(['insertMenuItem', 'get']) |
|
228 | + ->setMethods([ 'insertMenuItem', 'get' ]) |
|
229 | 229 | ->disableOriginalConstructor() |
230 | 230 | ->getMock(); |
231 | 231 | $menuMapper->expects(static::once()) |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | ->getMock(); |
240 | 240 | $menuService = new \Menu\Service\MenuService($menuMapper, $menuFilter, $categoryService, $pageService); |
241 | 241 | |
242 | - static::assertSame(true, $menuService->addMenuItem(['page_id' => false, 'category_id' => false, 'href' => 'test'])); |
|
242 | + static::assertSame(true, $menuService->addMenuItem([ 'page_id' => false, 'category_id' => false, 'href' => 'test' ])); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | public function testUpdateMenuItemShouldReturnTrue() |
246 | 246 | { |
247 | 247 | $menuFilter = $this->getMockBuilder(\Menu\Filter\MenuFilter::class) |
248 | - ->setMethods(['getInputFilter', 'setData', 'isValid', 'getValues']) |
|
248 | + ->setMethods([ 'getInputFilter', 'setData', 'isValid', 'getValues' ]) |
|
249 | 249 | ->disableOriginalConstructor() |
250 | 250 | ->getMock(); |
251 | 251 | $menuFilter->expects(static::once()) |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | ->willReturn(true); |
260 | 260 | $menuFilter->expects(static::once()) |
261 | 261 | ->method('getValues') |
262 | - ->willReturn(['page_id' => false, 'category_id' => false, 'href' => 'test']); |
|
262 | + ->willReturn([ 'page_id' => false, 'category_id' => false, 'href' => 'test' ]); |
|
263 | 263 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
264 | - ->setMethods(['updateMenuItem']) |
|
264 | + ->setMethods([ 'updateMenuItem' ]) |
|
265 | 265 | ->disableOriginalConstructor() |
266 | 266 | ->getMock(); |
267 | 267 | $menuMapper->expects(static::once()) |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | ->getMock(); |
276 | 276 | $menuService = new \Menu\Service\MenuService($menuMapper, $menuFilter, $categoryService, $pageService); |
277 | 277 | |
278 | - static::assertSame(true, $menuService->updateMenuItem(['page_id' => false, 'category_id' => false, 'href' => 'test'], 1)); |
|
278 | + static::assertSame(true, $menuService->updateMenuItem([ 'page_id' => false, 'category_id' => false, 'href' => 'test' ], 1)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | public function testDeleteShouldReturnTrue() |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | ->disableOriginalConstructor() |
285 | 285 | ->getMock(); |
286 | 286 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
287 | - ->setMethods(['select', 'delete']) |
|
287 | + ->setMethods([ 'select', 'delete' ]) |
|
288 | 288 | ->disableOriginalConstructor() |
289 | 289 | ->getMock(); |
290 | 290 | $menuMapper->expects(static::once()) |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | public function testDeleteShouldThrowException() |
312 | 312 | { |
313 | 313 | $resultSet = $this->getMockBuilder(\Zend\Db\ResultSet\ResultSet::class) |
314 | - ->setMethods(['count']) |
|
314 | + ->setMethods([ 'count' ]) |
|
315 | 315 | ->getMockForAbstractClass(); |
316 | 316 | $resultSet->expects(static::once()) |
317 | 317 | ->method('count') |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | ->disableOriginalConstructor() |
321 | 321 | ->getMock(); |
322 | 322 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
323 | - ->setMethods(['select']) |
|
323 | + ->setMethods([ 'select' ]) |
|
324 | 324 | ->disableOriginalConstructor() |
325 | 325 | ->getMock(); |
326 | 326 | $menuMapper->expects(static::once()) |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | ->disableOriginalConstructor() |
344 | 344 | ->getMock(); |
345 | 345 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
346 | - ->setMethods(['forSelect']) |
|
346 | + ->setMethods([ 'forSelect' ]) |
|
347 | 347 | ->disableOriginalConstructor() |
348 | 348 | ->getMock(); |
349 | 349 | $menuMapper->expects(static::once()) |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | ->disableOriginalConstructor() |
391 | 391 | ->getMock(); |
392 | 392 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
393 | - ->setMethods(['getAdapter']) |
|
393 | + ->setMethods([ 'getAdapter' ]) |
|
394 | 394 | ->disableOriginalConstructor() |
395 | 395 | ->getMock(); |
396 | 396 | $menuMapper->expects(static::exactly(2)) |
@@ -412,14 +412,14 @@ discard block |
||
412 | 412 | $child = new \stdClass(); |
413 | 413 | $child->id = 1; |
414 | 414 | $parent = new \stdClass(); |
415 | - $parent->children = [$child]; |
|
415 | + $parent->children = [ $child ]; |
|
416 | 416 | $parent->id = 2; |
417 | 417 | |
418 | 418 | $menuFilter = $this->getMockBuilder(\Menu\Filter\MenuFilter::class) |
419 | 419 | ->disableOriginalConstructor() |
420 | 420 | ->getMock(); |
421 | 421 | $menuMapper = $this->getMockBuilder(\Menu\Mapper\MenuMapper::class) |
422 | - ->setMethods(['getAdapter', 'getDriver', 'getConnection', 'beginTransaction', 'commit', 'update']) |
|
422 | + ->setMethods([ 'getAdapter', 'getDriver', 'getConnection', 'beginTransaction', 'commit', 'update' ]) |
|
423 | 423 | ->disableOriginalConstructor() |
424 | 424 | ->getMock(); |
425 | 425 | $menuMapper->expects(static::exactly(2)) |
@@ -448,6 +448,6 @@ discard block |
||
448 | 448 | ->getMock(); |
449 | 449 | $menuService = new \Menu\Service\MenuService($menuMapper, $menuFilter, $categoryService, $pageService); |
450 | 450 | |
451 | - static::assertSame(true, $menuService->updateMenuOrder([$parent])); |
|
451 | + static::assertSame(true, $menuService->updateMenuOrder([ $parent ])); |
|
452 | 452 | } |
453 | 453 | } |