@@ -21,75 +21,75 @@ discard block |
||
21 | 21 | $this->view = \TestHelperJqadm::getView(); |
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | |
24 | - $langManager = \Aimeos\MShop::create( $this->context, 'locale/language' ); |
|
24 | + $langManager = \Aimeos\MShop::create($this->context, 'locale/language'); |
|
25 | 25 | |
26 | - $this->view->pageLanguages = $langManager->search( $langManager->filter() ); |
|
27 | - $this->view->item = \Aimeos\MShop::create( $this->context, 'cms' )->create(); |
|
26 | + $this->view->pageLanguages = $langManager->search($langManager->filter()); |
|
27 | + $this->view->item = \Aimeos\MShop::create($this->context, 'cms')->create(); |
|
28 | 28 | |
29 | - $this->object = new \Aimeos\Admin\JQAdm\Cms\Content\Standard( $this->context ); |
|
30 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
31 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
32 | - $this->object->setView( $this->view ); |
|
29 | + $this->object = new \Aimeos\Admin\JQAdm\Cms\Content\Standard($this->context); |
|
30 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
31 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
32 | + $this->object->setView($this->view); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | protected function tearDown() : void |
37 | 37 | { |
38 | - unset( $this->object, $this->view, $this->context ); |
|
38 | + unset($this->object, $this->view, $this->context); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | 42 | public function testCreate() |
43 | 43 | { |
44 | - $manager = \Aimeos\MShop::create( $this->context, 'cms' ); |
|
44 | + $manager = \Aimeos\MShop::create($this->context, 'cms'); |
|
45 | 45 | |
46 | 46 | $this->view->item = $manager->create(); |
47 | 47 | $result = $this->object->create(); |
48 | 48 | |
49 | - $this->assertStringContainsString( 'item-content', $result ); |
|
50 | - $this->assertEmpty( $this->view->get( 'errors' ) ); |
|
49 | + $this->assertStringContainsString('item-content', $result); |
|
50 | + $this->assertEmpty($this->view->get('errors')); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | public function testCopy() |
55 | 55 | { |
56 | - $manager = \Aimeos\MShop::create( $this->context, 'cms' ); |
|
56 | + $manager = \Aimeos\MShop::create($this->context, 'cms'); |
|
57 | 57 | |
58 | - $this->view->item = $manager->find( '/contact', ['text'] ); |
|
58 | + $this->view->item = $manager->find('/contact', ['text']); |
|
59 | 59 | $result = $this->object->copy(); |
60 | 60 | |
61 | - $this->assertEmpty( $this->view->get( 'errors' ) ); |
|
62 | - $this->assertStringContainsString( 'Hello', $result ); |
|
61 | + $this->assertEmpty($this->view->get('errors')); |
|
62 | + $this->assertStringContainsString('Hello', $result); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | 66 | public function testDelete() |
67 | 67 | { |
68 | - $manager = \Aimeos\MShop::create( $this->context, 'cms' ); |
|
68 | + $manager = \Aimeos\MShop::create($this->context, 'cms'); |
|
69 | 69 | |
70 | 70 | $this->view->item = $manager->create(); |
71 | 71 | $result = $this->object->delete(); |
72 | 72 | |
73 | - $this->assertEmpty( $this->view->get( 'errors' ) ); |
|
74 | - $this->assertEmpty( $result ); |
|
73 | + $this->assertEmpty($this->view->get('errors')); |
|
74 | + $this->assertEmpty($result); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testGet() |
79 | 79 | { |
80 | - $manager = \Aimeos\MShop::create( $this->context, 'cms' ); |
|
80 | + $manager = \Aimeos\MShop::create($this->context, 'cms'); |
|
81 | 81 | |
82 | - $this->view->item = $manager->find( '/contact', ['text'] ); |
|
82 | + $this->view->item = $manager->find('/contact', ['text']); |
|
83 | 83 | $result = $this->object->get(); |
84 | 84 | |
85 | - $this->assertEmpty( $this->view->get( 'errors' ) ); |
|
86 | - $this->assertStringContainsString( 'Hello', $result ); |
|
85 | + $this->assertEmpty($this->view->get('errors')); |
|
86 | + $this->assertStringContainsString('Hello', $result); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | 90 | public function testSave() |
91 | 91 | { |
92 | - $manager = \Aimeos\MShop::create( $this->context, 'cms' ); |
|
92 | + $manager = \Aimeos\MShop::create($this->context, 'cms'); |
|
93 | 93 | $item = $manager->create(); |
94 | 94 | |
95 | 95 | $param = array( |
@@ -112,76 +112,76 @@ discard block |
||
112 | 112 | ), |
113 | 113 | ); |
114 | 114 | |
115 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
116 | - $this->view->addHelper( 'param', $helper ); |
|
115 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
116 | + $this->view->addHelper('param', $helper); |
|
117 | 117 | $this->view->item = $item; |
118 | 118 | |
119 | 119 | $result = $this->object->save(); |
120 | 120 | $listItems = $item->getListItems(); |
121 | 121 | |
122 | - $this->assertEmpty( $this->view->get( 'errors' ) ); |
|
123 | - $this->assertEmpty( $result ); |
|
124 | - $this->assertEquals( 2, count( $listItems ) ); |
|
122 | + $this->assertEmpty($this->view->get('errors')); |
|
123 | + $this->assertEmpty($result); |
|
124 | + $this->assertEquals(2, count($listItems)); |
|
125 | 125 | |
126 | - $this->assertEquals( [0, 1], $listItems->getPosition()->values()->toArray() ); |
|
127 | - $this->assertEquals( ['text', 'text'], $listItems->getDomain()->values()->toArray() ); |
|
126 | + $this->assertEquals([0, 1], $listItems->getPosition()->values()->toArray()); |
|
127 | + $this->assertEquals(['text', 'text'], $listItems->getDomain()->values()->toArray()); |
|
128 | 128 | |
129 | 129 | $refItems = $listItems->getRefItem(); |
130 | 130 | |
131 | - $this->assertEquals( ['en', 'de'], $refItems->getLanguageId()->values()->toArray() ); |
|
132 | - $this->assertEquals( ['<h1>Hello!</h1>', '<h1>Hallo!</h1>'], $refItems->getContent()->values()->toArray() ); |
|
131 | + $this->assertEquals(['en', 'de'], $refItems->getLanguageId()->values()->toArray()); |
|
132 | + $this->assertEquals(['<h1>Hello!</h1>', '<h1>Hallo!</h1>'], $refItems->getContent()->values()->toArray()); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
136 | 136 | public function testSaveException() |
137 | 137 | { |
138 | - $object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Cms\Content\Standard::class ) |
|
139 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
140 | - ->setMethods( array( 'fromArray' ) ) |
|
138 | + $object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Cms\Content\Standard::class) |
|
139 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
140 | + ->setMethods(array('fromArray')) |
|
141 | 141 | ->getMock(); |
142 | 142 | |
143 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
144 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
143 | + $object->expects($this->once())->method('fromArray') |
|
144 | + ->will($this->throwException(new \RuntimeException())); |
|
145 | 145 | |
146 | 146 | $this->view = \TestHelperJqadm::getView(); |
147 | - $this->view->item = \Aimeos\MShop::create( $this->context, 'cms' )->create(); |
|
147 | + $this->view->item = \Aimeos\MShop::create($this->context, 'cms')->create(); |
|
148 | 148 | |
149 | - $object->setView( $this->view ); |
|
149 | + $object->setView($this->view); |
|
150 | 150 | |
151 | - $this->expectException( \RuntimeException::class ); |
|
151 | + $this->expectException(\RuntimeException::class); |
|
152 | 152 | $object->save(); |
153 | 153 | } |
154 | 154 | |
155 | 155 | |
156 | 156 | public function testSaveMShopException() |
157 | 157 | { |
158 | - $object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Cms\Content\Standard::class ) |
|
159 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
160 | - ->setMethods( array( 'fromArray' ) ) |
|
158 | + $object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Cms\Content\Standard::class) |
|
159 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
160 | + ->setMethods(array('fromArray')) |
|
161 | 161 | ->getMock(); |
162 | 162 | |
163 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
164 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
163 | + $object->expects($this->once())->method('fromArray') |
|
164 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
165 | 165 | |
166 | 166 | $this->view = \TestHelperJqadm::getView(); |
167 | - $this->view->item = \Aimeos\MShop::create( $this->context, 'cms' )->create(); |
|
167 | + $this->view->item = \Aimeos\MShop::create($this->context, 'cms')->create(); |
|
168 | 168 | |
169 | - $object->setView( $this->view ); |
|
169 | + $object->setView($this->view); |
|
170 | 170 | |
171 | - $this->expectException( \Aimeos\MShop\Exception::class ); |
|
171 | + $this->expectException(\Aimeos\MShop\Exception::class); |
|
172 | 172 | $object->save(); |
173 | 173 | } |
174 | 174 | |
175 | 175 | |
176 | 176 | public function testSearch() |
177 | 177 | { |
178 | - $this->assertEmpty( $this->object->search() ); |
|
178 | + $this->assertEmpty($this->object->search()); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
182 | 182 | public function testGetSubClient() |
183 | 183 | { |
184 | - $this->expectException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
185 | - $this->object->getSubClient( 'unknown' ); |
|
184 | + $this->expectException(\Aimeos\Admin\JQAdm\Exception::class); |
|
185 | + $this->object->getSubClient('unknown'); |
|
186 | 186 | } |
187 | 187 | } |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | protected function setUp() : void |
20 | 20 | { |
21 | 21 | $this->view = \TestHelperJqadm::getView(); |
22 | - $request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock(); |
|
23 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
24 | - $this->view ->addHelper( 'request', $helper ); |
|
22 | + $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock(); |
|
23 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
24 | + $this->view ->addHelper('request', $helper); |
|
25 | 25 | |
26 | 26 | $this->context = \TestHelperJqadm::getContext(); |
27 | 27 | |
28 | - $this->object = new \Aimeos\Admin\JQAdm\Cms\Standard( $this->context ); |
|
29 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
30 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
31 | - $this->object->setView( $this->view ); |
|
28 | + $this->object = new \Aimeos\Admin\JQAdm\Cms\Standard($this->context); |
|
29 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
30 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
31 | + $this->object->setView($this->view); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function tearDown() : void |
36 | 36 | { |
37 | - unset( $this->object, $this->view, $this->context ); |
|
37 | + unset($this->object, $this->view, $this->context); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | { |
43 | 43 | $result = $this->object->create(); |
44 | 44 | |
45 | - $this->assertStringContainsString( 'cms', $result ); |
|
46 | - $this->assertEmpty( $this->view->get( 'errors' ) ); |
|
45 | + $this->assertStringContainsString('cms', $result); |
|
46 | + $this->assertEmpty($this->view->get('errors')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testCreateException() |
51 | 51 | { |
52 | - $object = $this->getClientMock( 'getSubClients' ); |
|
52 | + $object = $this->getClientMock('getSubClients'); |
|
53 | 53 | |
54 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
55 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
54 | + $object->expects($this->once())->method('getSubClients') |
|
55 | + ->will($this->throwException(new \RuntimeException())); |
|
56 | 56 | |
57 | 57 | $object->create(); |
58 | 58 | } |
@@ -60,24 +60,24 @@ discard block |
||
60 | 60 | |
61 | 61 | public function testCopy() |
62 | 62 | { |
63 | - $manager = \Aimeos\MShop::create( $this->context, 'cms' ); |
|
63 | + $manager = \Aimeos\MShop::create($this->context, 'cms'); |
|
64 | 64 | |
65 | - $param = ['site' => 'unittest', 'id' => $manager->find( '/contact' )->getId()]; |
|
66 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
67 | - $this->view->addHelper( 'param', $helper ); |
|
65 | + $param = ['site' => 'unittest', 'id' => $manager->find('/contact')->getId()]; |
|
66 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
67 | + $this->view->addHelper('param', $helper); |
|
68 | 68 | |
69 | 69 | $result = $this->object->copy(); |
70 | 70 | |
71 | - $this->assertStringContainsString( '/contact_copy', $result ); |
|
71 | + $this->assertStringContainsString('/contact_copy', $result); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | public function testCopyException() |
76 | 76 | { |
77 | - $object = $this->getClientMock( 'getSubClients' ); |
|
77 | + $object = $this->getClientMock('getSubClients'); |
|
78 | 78 | |
79 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
80 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
79 | + $object->expects($this->once())->method('getSubClients') |
|
80 | + ->will($this->throwException(new \RuntimeException())); |
|
81 | 81 | |
82 | 82 | $object->copy(); |
83 | 83 | } |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | |
86 | 86 | public function testDelete() |
87 | 87 | { |
88 | - $this->assertNull( $this->getClientMock( ['redirect'], false )->delete() ); |
|
88 | + $this->assertNull($this->getClientMock(['redirect'], false)->delete()); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
92 | 92 | public function testDeleteException() |
93 | 93 | { |
94 | - $object = $this->getClientMock( ['getSubClients', 'search'] ); |
|
94 | + $object = $this->getClientMock(['getSubClients', 'search']); |
|
95 | 95 | |
96 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
97 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
98 | - $object->expects( $this->once() )->method( 'search' ); |
|
96 | + $object->expects($this->once())->method('getSubClients') |
|
97 | + ->will($this->throwException(new \RuntimeException())); |
|
98 | + $object->expects($this->once())->method('search'); |
|
99 | 99 | |
100 | 100 | $object->delete(); |
101 | 101 | } |
@@ -103,24 +103,24 @@ discard block |
||
103 | 103 | |
104 | 104 | public function testGet() |
105 | 105 | { |
106 | - $manager = \Aimeos\MShop::create( $this->context, 'cms' ); |
|
106 | + $manager = \Aimeos\MShop::create($this->context, 'cms'); |
|
107 | 107 | |
108 | - $param = ['site' => 'unittest', 'id' => $manager->find( '/contact' )->getId()]; |
|
109 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
110 | - $this->view->addHelper( 'param', $helper ); |
|
108 | + $param = ['site' => 'unittest', 'id' => $manager->find('/contact')->getId()]; |
|
109 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
110 | + $this->view->addHelper('param', $helper); |
|
111 | 111 | |
112 | 112 | $result = $this->object->get(); |
113 | 113 | |
114 | - $this->assertStringContainsString( '/contact', $result ); |
|
114 | + $this->assertStringContainsString('/contact', $result); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | 118 | public function testGetException() |
119 | 119 | { |
120 | - $object = $this->getClientMock( 'getSubClients' ); |
|
120 | + $object = $this->getClientMock('getSubClients'); |
|
121 | 121 | |
122 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
123 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
122 | + $object->expects($this->once())->method('getSubClients') |
|
123 | + ->will($this->throwException(new \RuntimeException())); |
|
124 | 124 | |
125 | 125 | $object->get(); |
126 | 126 | } |
@@ -128,16 +128,16 @@ discard block |
||
128 | 128 | |
129 | 129 | public function testGetViewException() |
130 | 130 | { |
131 | - $object = new \Aimeos\Admin\JQAdm\Cms\Standard( $this->context, [] ); |
|
131 | + $object = new \Aimeos\Admin\JQAdm\Cms\Standard($this->context, []); |
|
132 | 132 | |
133 | - $this->expectException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
133 | + $this->expectException(\Aimeos\Admin\JQAdm\Exception::class); |
|
134 | 134 | $object->getView(); |
135 | 135 | } |
136 | 136 | |
137 | 137 | |
138 | 138 | public function testSave() |
139 | 139 | { |
140 | - $manager = \Aimeos\MShop::create( $this->context, 'cms' ); |
|
140 | + $manager = \Aimeos\MShop::create($this->context, 'cms'); |
|
141 | 141 | |
142 | 142 | $param = array( |
143 | 143 | 'site' => 'unittest', |
@@ -149,24 +149,24 @@ discard block |
||
149 | 149 | ), |
150 | 150 | ); |
151 | 151 | |
152 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
153 | - $this->view->addHelper( 'param', $helper ); |
|
152 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
153 | + $this->view->addHelper('param', $helper); |
|
154 | 154 | |
155 | 155 | $result = $this->object->save(); |
156 | 156 | |
157 | - $manager->delete( $manager->find( '/contact-jqadm' ) ); |
|
157 | + $manager->delete($manager->find('/contact-jqadm')); |
|
158 | 158 | |
159 | - $this->assertEmpty( $this->view->get( 'errors' ) ); |
|
160 | - $this->assertNull( $result ); |
|
159 | + $this->assertEmpty($this->view->get('errors')); |
|
160 | + $this->assertNull($result); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
164 | 164 | public function testSaveException() |
165 | 165 | { |
166 | - $object = $this->getClientMock( 'fromArray' ); |
|
166 | + $object = $this->getClientMock('fromArray'); |
|
167 | 167 | |
168 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
169 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
168 | + $object->expects($this->once())->method('fromArray') |
|
169 | + ->will($this->throwException(new \RuntimeException())); |
|
170 | 170 | |
171 | 171 | $object->save(); |
172 | 172 | } |
@@ -177,27 +177,27 @@ discard block |
||
177 | 177 | $param = array( |
178 | 178 | 'site' => 'unittest', 'lang' => 'de', |
179 | 179 | 'filter' => array( |
180 | - 'key' => array( 0 => 'cms.url' ), |
|
181 | - 'op' => array( 0 => '==' ), |
|
182 | - 'val' => array( 0 => '/contact' ), |
|
180 | + 'key' => array(0 => 'cms.url'), |
|
181 | + 'op' => array(0 => '=='), |
|
182 | + 'val' => array(0 => '/contact'), |
|
183 | 183 | ), |
184 | - 'sort' => array( 'cms.label', '-cms.id' ), |
|
184 | + 'sort' => array('cms.label', '-cms.id'), |
|
185 | 185 | ); |
186 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
187 | - $this->view->addHelper( 'param', $helper ); |
|
186 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
187 | + $this->view->addHelper('param', $helper); |
|
188 | 188 | |
189 | 189 | $result = $this->object->search(); |
190 | 190 | |
191 | - $this->assertStringContainsString( '/contact', $result ); |
|
191 | + $this->assertStringContainsString('/contact', $result); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
195 | 195 | public function testSearchException() |
196 | 196 | { |
197 | - $object = $this->getClientMock( 'initCriteria' ); |
|
197 | + $object = $this->getClientMock('initCriteria'); |
|
198 | 198 | |
199 | - $object->expects( $this->once() )->method( 'initCriteria' ) |
|
200 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
199 | + $object->expects($this->once())->method('initCriteria') |
|
200 | + ->will($this->throwException(new \RuntimeException())); |
|
201 | 201 | |
202 | 202 | $object->search(); |
203 | 203 | } |
@@ -205,57 +205,57 @@ discard block |
||
205 | 205 | |
206 | 206 | public function testGetSubClient() |
207 | 207 | { |
208 | - $result = $this->object->getSubClient( 'seo' ); |
|
209 | - $this->assertInstanceOf( \Aimeos\Admin\JQAdm\Iface::class, $result ); |
|
208 | + $result = $this->object->getSubClient('seo'); |
|
209 | + $this->assertInstanceOf(\Aimeos\Admin\JQAdm\Iface::class, $result); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
213 | 213 | public function testGetSubClientInvalid() |
214 | 214 | { |
215 | - $this->expectException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
216 | - $this->object->getSubClient( '$unknown$' ); |
|
215 | + $this->expectException(\Aimeos\Admin\JQAdm\Exception::class); |
|
216 | + $this->object->getSubClient('$unknown$'); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
220 | 220 | public function testGetSubClientUnknown() |
221 | 221 | { |
222 | - $this->expectException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
223 | - $this->object->getSubClient( 'unknown' ); |
|
222 | + $this->expectException(\Aimeos\Admin\JQAdm\Exception::class); |
|
223 | + $this->object->getSubClient('unknown'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
227 | - public function getClientMock( $methods, $real = true ) |
|
227 | + public function getClientMock($methods, $real = true) |
|
228 | 228 | { |
229 | - $object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Cms\Standard::class ) |
|
230 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
231 | - ->setMethods( (array) $methods ) |
|
229 | + $object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Cms\Standard::class) |
|
230 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
231 | + ->setMethods((array) $methods) |
|
232 | 232 | ->getMock(); |
233 | 233 | |
234 | - $object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
235 | - $object->setView( $this->getViewNoRender( $real ) ); |
|
234 | + $object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
235 | + $object->setView($this->getViewNoRender($real)); |
|
236 | 236 | |
237 | 237 | return $object; |
238 | 238 | } |
239 | 239 | |
240 | 240 | |
241 | - protected function getViewNoRender( $real = true ) |
|
241 | + protected function getViewNoRender($real = true) |
|
242 | 242 | { |
243 | - $view = $this->getMockBuilder( \Aimeos\MW\View\Standard::class ) |
|
244 | - ->setConstructorArgs( array( [] ) ) |
|
245 | - ->setMethods( array( 'render' ) ) |
|
243 | + $view = $this->getMockBuilder(\Aimeos\MW\View\Standard::class) |
|
244 | + ->setConstructorArgs(array([])) |
|
245 | + ->setMethods(array('render')) |
|
246 | 246 | ->getMock(); |
247 | 247 | |
248 | - $manager = \Aimeos\MShop::create( $this->context, 'cms' ); |
|
248 | + $manager = \Aimeos\MShop::create($this->context, 'cms'); |
|
249 | 249 | |
250 | - $param = ['site' => 'unittest', 'id' => $real ? $manager->find( '/contact' )->getId() : -1]; |
|
251 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
|
252 | - $view->addHelper( 'param', $helper ); |
|
250 | + $param = ['site' => 'unittest', 'id' => $real ? $manager->find('/contact')->getId() : -1]; |
|
251 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param); |
|
252 | + $view->addHelper('param', $helper); |
|
253 | 253 | |
254 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $this->context->getConfig() ); |
|
255 | - $view->addHelper( 'config', $helper ); |
|
254 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $this->context->getConfig()); |
|
255 | + $view->addHelper('config', $helper); |
|
256 | 256 | |
257 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] ); |
|
258 | - $view->addHelper( 'access', $helper ); |
|
257 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []); |
|
258 | + $view->addHelper('access', $helper); |
|
259 | 259 | |
260 | 260 | return $view; |
261 | 261 | } |
@@ -4,17 +4,17 @@ |
||
4 | 4 | * Set error reporting to maximum |
5 | 5 | */ |
6 | 6 | error_reporting( -1 ); |
7 | -ini_set( 'display_errors', true ); |
|
7 | +ini_set('display_errors', true); |
|
8 | 8 | |
9 | -date_default_timezone_set( 'UTC' ); |
|
9 | +date_default_timezone_set('UTC'); |
|
10 | 10 | |
11 | 11 | /* |
12 | 12 | * Set locale settings to reasonable defaults |
13 | 13 | */ |
14 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
15 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
16 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
17 | -setlocale( LC_TIME, 'POSIX' ); |
|
14 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
15 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
16 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
17 | +setlocale(LC_TIME, 'POSIX'); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | require_once 'TestHelperJqadm.php'; |
@@ -13,16 +13,16 @@ discard block |
||
13 | 13 | |
14 | 14 | $includepaths = $aimeos->getIncludePaths(); |
15 | 15 | $includepaths[] = get_include_path(); |
16 | - set_include_path( implode( PATH_SEPARATOR, $includepaths ) ); |
|
16 | + set_include_path(implode(PATH_SEPARATOR, $includepaths)); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
20 | 20 | private static function getAimeos() |
21 | 21 | { |
22 | - if( !isset( self::$aimeos ) ) |
|
22 | + if (!isset(self::$aimeos)) |
|
23 | 23 | { |
24 | 24 | require_once 'Bootstrap.php'; |
25 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
25 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
26 | 26 | |
27 | 27 | self::$aimeos = new \Aimeos\Bootstrap(); |
28 | 28 | } |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | - public static function getContext( $site = 'unittest' ) |
|
34 | + public static function getContext($site = 'unittest') |
|
35 | 35 | { |
36 | - if( !isset( self::$context[$site] ) ) { |
|
37 | - self::$context[$site] = self::createContext( $site ); |
|
36 | + if (!isset(self::$context[$site])) { |
|
37 | + self::$context[$site] = self::createContext($site); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return clone self::$context[$site]; |
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | - private static function createContext( $site ) |
|
44 | + private static function createContext($site) |
|
45 | 45 | { |
46 | 46 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
47 | 47 | $aimeos = self::getAimeos(); |
@@ -50,37 +50,37 @@ discard block |
||
50 | 50 | $paths = $aimeos->getConfigPaths(); |
51 | 51 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
52 | 52 | |
53 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
54 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
55 | - $ctx->setConfig( $conf ); |
|
53 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
54 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
55 | + $ctx->setConfig($conf); |
|
56 | 56 | |
57 | 57 | |
58 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $conf ); |
|
59 | - $ctx->setDatabaseManager( $dbm ); |
|
58 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($conf); |
|
59 | + $ctx->setDatabaseManager($dbm); |
|
60 | 60 | |
61 | 61 | |
62 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
63 | - $ctx->setLogger( $logger ); |
|
62 | + $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
63 | + $ctx->setLogger($logger); |
|
64 | 64 | |
65 | 65 | |
66 | 66 | $cache = new \Aimeos\MW\Cache\None(); |
67 | - $ctx->setCache( $cache ); |
|
67 | + $ctx->setCache($cache); |
|
68 | 68 | |
69 | 69 | |
70 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
71 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
70 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
71 | + $ctx->setI18n(array('de' => $i18n)); |
|
72 | 72 | |
73 | 73 | |
74 | 74 | $session = new \Aimeos\MW\Session\None(); |
75 | - $ctx->setSession( $session ); |
|
75 | + $ctx->setSession($session); |
|
76 | 76 | |
77 | 77 | |
78 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx ); |
|
79 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
80 | - $ctx->setLocale( $locale ); |
|
78 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create($ctx); |
|
79 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
80 | + $ctx->setLocale($locale); |
|
81 | 81 | |
82 | 82 | |
83 | - $ctx->setEditor( 'ai-cms-grapesjs:cntl/frontend' ); |
|
83 | + $ctx->setEditor('ai-cms-grapesjs:cntl/frontend'); |
|
84 | 84 | |
85 | 85 | return $ctx; |
86 | 86 | } |
@@ -4,17 +4,17 @@ |
||
4 | 4 | * Set error reporting to maximum |
5 | 5 | */ |
6 | 6 | error_reporting( -1 ); |
7 | -ini_set( 'display_errors', true ); |
|
7 | +ini_set('display_errors', true); |
|
8 | 8 | |
9 | -date_default_timezone_set( 'UTC' ); |
|
9 | +date_default_timezone_set('UTC'); |
|
10 | 10 | |
11 | 11 | /* |
12 | 12 | * Set locale settings to reasonable defaults |
13 | 13 | */ |
14 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
15 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
16 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
17 | -setlocale( LC_TIME, 'POSIX' ); |
|
14 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
15 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
16 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
17 | +setlocale(LC_TIME, 'POSIX'); |
|
18 | 18 | |
19 | 19 | require_once 'TestHelperFrontend.php'; |
20 | 20 | \TestHelperFrontend::bootstrap(); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @throws \Aimeos\MShop\Cms\Exception|\Aimeos\MShop\Exception If requested manager |
31 | 31 | * implementation couldn't be found or initialisation fails |
32 | 32 | */ |
33 | - public static function create( \Aimeos\MShop\Context\Item\Iface $concms, string $name = null ) : \Aimeos\MShop\Common\Manager\Iface |
|
33 | + public static function create(\Aimeos\MShop\Context\Item\Iface $concms, string $name = null) : \Aimeos\MShop\Common\Manager\Iface |
|
34 | 34 | { |
35 | 35 | /** mshop/cms/manager/name |
36 | 36 | * Class name of the used cms manager implementation |
@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | * @since 2020.10 |
66 | 66 | * @category Developer |
67 | 67 | */ |
68 | - if( $name === null ) { |
|
69 | - $name = $concms->getConfig()->get( 'mshop/cms/manager/name', 'Standard' ); |
|
68 | + if ($name === null) { |
|
69 | + $name = $concms->getConfig()->get('mshop/cms/manager/name', 'Standard'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $iface = \Aimeos\MShop\Cms\Manager\Iface::class; |
73 | 73 | $classname = '\Aimeos\MShop\Cms\Manager\\' . $name; |
74 | 74 | |
75 | - if( ctype_alnum( $name ) === false ) { |
|
76 | - throw new \Aimeos\MShop\Cms\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
75 | + if (ctype_alnum($name) === false) { |
|
76 | + throw new \Aimeos\MShop\Cms\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
77 | 77 | } |
78 | 78 | |
79 | - $manager = self::createManager( $concms, $classname, $iface ); |
|
79 | + $manager = self::createManager($concms, $classname, $iface); |
|
80 | 80 | |
81 | 81 | /** mshop/cms/manager/decorators/excludes |
82 | 82 | * Excludes decorators added by the "common" option from the cms manager |
@@ -153,6 +153,6 @@ discard block |
||
153 | 153 | * @see mshop/cms/manager/decorators/excludes |
154 | 154 | * @see mshop/cms/manager/decorators/global |
155 | 155 | */ |
156 | - return self::addManagerDecorators( $concms, $manager, 'cms' ); |
|
156 | + return self::addManagerDecorators($concms, $manager, 'cms'); |
|
157 | 157 | } |
158 | 158 | } |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
106 | 106 | */ |
107 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
107 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
108 | 108 | { |
109 | - parent::__construct( $context ); |
|
110 | - $this->setResourceName( 'db-cms' ); |
|
109 | + parent::__construct($context); |
|
110 | + $this->setResourceName('db-cms'); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | * @param iterable $siteids List of IDs for sites whose entries should be deleted |
118 | 118 | * @return \Aimeos\MShop\Cms\Manager\Lists\Type\Iface Manager object for chaining method calls |
119 | 119 | */ |
120 | - public function clear( iterable $siteids ) : \Aimeos\MShop\Common\Manager\Iface |
|
120 | + public function clear(iterable $siteids) : \Aimeos\MShop\Common\Manager\Iface |
|
121 | 121 | { |
122 | 122 | $path = 'mshop/cms/manager/lists/type/submanagers'; |
123 | - foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) { |
|
124 | - $this->getObject()->getSubManager( $domain )->clear( $siteids ); |
|
123 | + foreach ($this->getContext()->getConfig()->get($path, []) as $domain) { |
|
124 | + $this->getObject()->getSubManager($domain)->clear($siteids); |
|
125 | 125 | } |
126 | 126 | |
127 | - return $this->clearBase( $siteids, 'mshop/cms/manager/lists/type/delete' ); |
|
127 | + return $this->clearBase($siteids, 'mshop/cms/manager/lists/type/delete'); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * @param bool $withsub Return also the resource type of sub-managers if true |
135 | 135 | * @return string[] Type of the manager and submanagers, subtypes are separated by slashes |
136 | 136 | */ |
137 | - public function getResourceType( bool $withsub = true ) : array |
|
137 | + public function getResourceType(bool $withsub = true) : array |
|
138 | 138 | { |
139 | 139 | $path = 'mshop/cms/manager/lists/type/submanagers'; |
140 | - return $this->getResourceTypeBase( 'cms/lists/type', $path, [], $withsub ); |
|
140 | + return $this->getResourceTypeBase('cms/lists/type', $path, [], $withsub); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param bool $withsub Return also attributes of sub-managers if true |
148 | 148 | * @return \Aimeos\MW\Criteria\Attribute\Iface[] List of search attribute items |
149 | 149 | */ |
150 | - public function getSearchAttributes( bool $withsub = true ) : array |
|
150 | + public function getSearchAttributes(bool $withsub = true) : array |
|
151 | 151 | { |
152 | 152 | /** mshop/cms/manager/lists/type/submanagers |
153 | 153 | * List of manager names that can be instantiated by the cms list type manager |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | $path = 'mshop/cms/manager/lists/type/submanagers'; |
170 | 170 | |
171 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
|
171 | + return $this->getSearchAttributesBase($this->searchConfig, $path, [], $withsub); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
180 | 180 | * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g types, lists etc. |
181 | 181 | */ |
182 | - public function getSubManager( string $manager, string $name = null ) : \Aimeos\MShop\Common\Manager\Iface |
|
182 | + public function getSubManager(string $manager, string $name = null) : \Aimeos\MShop\Common\Manager\Iface |
|
183 | 183 | { |
184 | 184 | /** mshop/cms/manager/lists/type/name |
185 | 185 | * Class name of the used cms list type manager implementation |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @see mshop/cms/manager/lists/type/decorators/global |
294 | 294 | */ |
295 | 295 | |
296 | - return $this->getSubManagerBase( 'cms', 'lists/type/' . $manager, $name ); |
|
296 | + return $this->getSubManagerBase('cms', 'lists/type/' . $manager, $name); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
144 | 144 | */ |
145 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
145 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
146 | 146 | { |
147 | - parent::__construct( $context ); |
|
148 | - $this->setResourceName( 'db-cms' ); |
|
147 | + parent::__construct($context); |
|
148 | + $this->setResourceName('db-cms'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -155,14 +155,14 @@ discard block |
||
155 | 155 | * @param iterable $siteids List of IDs for sites whose entries should be deleted |
156 | 156 | * @return \Aimeos\MShop\Cms\Manager\Lists\Iface Manager object for chaining method calls |
157 | 157 | */ |
158 | - public function clear( iterable $siteids ) : \Aimeos\MShop\Common\Manager\Iface |
|
158 | + public function clear(iterable $siteids) : \Aimeos\MShop\Common\Manager\Iface |
|
159 | 159 | { |
160 | 160 | $path = 'mshop/cms/manager/lists/submanagers'; |
161 | - foreach( $this->getContext()->getConfig()->get( $path, ['type'] ) as $domain ) { |
|
162 | - $this->getObject()->getSubManager( $domain )->clear( $siteids ); |
|
161 | + foreach ($this->getContext()->getConfig()->get($path, ['type']) as $domain) { |
|
162 | + $this->getObject()->getSubManager($domain)->clear($siteids); |
|
163 | 163 | } |
164 | 164 | |
165 | - return $this->clearBase( $siteids, 'mshop/cms/manager/lists/delete' ); |
|
165 | + return $this->clearBase($siteids, 'mshop/cms/manager/lists/delete'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | * @param bool $withsub Return also the resource type of sub-managers if true |
173 | 173 | * @return string[] Type of the manager and submanagers, subtypes are separated by slashes |
174 | 174 | */ |
175 | - public function getResourceType( bool $withsub = true ) : array |
|
175 | + public function getResourceType(bool $withsub = true) : array |
|
176 | 176 | { |
177 | 177 | $path = 'mshop/cms/manager/lists/submanagers'; |
178 | - return $this->getResourceTypeBase( 'cms/lists', $path, [], $withsub ); |
|
178 | + return $this->getResourceTypeBase('cms/lists', $path, [], $withsub); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param bool $withsub Return also attributes of sub-managers if true |
186 | 186 | * @return \Aimeos\MW\Criteria\Attribute\Iface[] List of search attribute items |
187 | 187 | */ |
188 | - public function getSearchAttributes( bool $withsub = true ) : array |
|
188 | + public function getSearchAttributes(bool $withsub = true) : array |
|
189 | 189 | { |
190 | 190 | /** mshop/cms/manager/lists/submanagers |
191 | 191 | * List of manager names that can be instantiated by the cms list manager |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | $path = 'mshop/cms/manager/lists/submanagers'; |
208 | 208 | |
209 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
|
209 | + return $this->getSearchAttributesBase($this->searchConfig, $path, [], $withsub); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
218 | 218 | * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g types, lists etc. |
219 | 219 | */ |
220 | - public function getSubManager( string $manager, string $name = null ) : \Aimeos\MShop\Common\Manager\Iface |
|
220 | + public function getSubManager(string $manager, string $name = null) : \Aimeos\MShop\Common\Manager\Iface |
|
221 | 221 | { |
222 | 222 | /** mshop/cms/manager/lists/name |
223 | 223 | * Class name of the used cms list manager implementation |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @see mshop/cms/manager/lists/decorators/global |
331 | 331 | */ |
332 | 332 | |
333 | - return $this->getSubManagerBase( 'cms', 'lists/' . $manager, $name ); |
|
333 | + return $this->getSubManagerBase('cms', 'lists/' . $manager, $name); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 |
@@ -103,30 +103,30 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
105 | 105 | */ |
106 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
106 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
107 | 107 | { |
108 | - parent::__construct( $context ); |
|
108 | + parent::__construct($context); |
|
109 | 109 | |
110 | - $this->setResourceName( 'db-cms' ); |
|
110 | + $this->setResourceName('db-cms'); |
|
111 | 111 | $this->languageId = $context->getLocale()->getLanguageId(); |
112 | 112 | |
113 | 113 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ONE; |
114 | - $level = $context->getConfig()->get( 'mshop/cms/manager/sitemode', $level ); |
|
114 | + $level = $context->getConfig()->get('mshop/cms/manager/sitemode', $level); |
|
115 | 115 | |
116 | 116 | |
117 | - $this->searchConfig['cms:has']['function'] = function( &$source, array $params ) use ( $level ) { |
|
117 | + $this->searchConfig['cms:has']['function'] = function(&$source, array $params) use ($level) { |
|
118 | 118 | |
119 | 119 | $keys = []; |
120 | 120 | |
121 | - foreach( (array) ( $params[1] ?? '' ) as $type ) { |
|
122 | - foreach( (array) ( $params[2] ?? '' ) as $id ) { |
|
123 | - $keys[] = $params[0] . '|' . ( $type ? $type . '|' : '' ) . $id; |
|
121 | + foreach ((array) ($params[1] ?? '') as $type) { |
|
122 | + foreach ((array) ($params[2] ?? '') as $id) { |
|
123 | + $keys[] = $params[0] . '|' . ($type ? $type . '|' : '') . $id; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - $sitestr = $this->getSiteString( 'mcmsli."siteid"', $level ); |
|
128 | - $keystr = $this->toExpression( 'mcmsli."key"', $keys, ( $params[2] ?? null ) ? '==' : '=~' ); |
|
129 | - $source = str_replace( [':site', ':key'], [$sitestr, $keystr], $source ); |
|
127 | + $sitestr = $this->getSiteString('mcmsli."siteid"', $level); |
|
128 | + $keystr = $this->toExpression('mcmsli."key"', $keys, ($params[2] ?? null) ? '==' : '=~'); |
|
129 | + $source = str_replace([':site', ':key'], [$sitestr, $keystr], $source); |
|
130 | 130 | |
131 | 131 | return $params; |
132 | 132 | }; |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | * @param iterable $siteids List of IDs for sites whose entries should be deleted |
140 | 140 | * @return \Aimeos\MShop\Cms\Manager\Iface Manager object for chaining method calls |
141 | 141 | */ |
142 | - public function clear( iterable $siteids ) : \Aimeos\MShop\Common\Manager\Iface |
|
142 | + public function clear(iterable $siteids) : \Aimeos\MShop\Common\Manager\Iface |
|
143 | 143 | { |
144 | 144 | $path = 'mshop/cms/manager/submanagers'; |
145 | - foreach( $this->getContext()->getConfig()->get( $path, ['lists'] ) as $domain ) { |
|
146 | - $this->getObject()->getSubManager( $domain )->clear( $siteids ); |
|
145 | + foreach ($this->getContext()->getConfig()->get($path, ['lists']) as $domain) { |
|
146 | + $this->getObject()->getSubManager($domain)->clear($siteids); |
|
147 | 147 | } |
148 | 148 | |
149 | - return $this->clearBase( $siteids, 'mshop/cms/manager/delete' ); |
|
149 | + return $this->clearBase($siteids, 'mshop/cms/manager/delete'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | * @param array $values Values the item should be initialized with |
157 | 157 | * @return \Aimeos\MShop\Cms\Item\Iface New cms item object |
158 | 158 | */ |
159 | - public function create( array $values = [] ) : \Aimeos\MShop\Common\Item\Iface |
|
159 | + public function create(array $values = []) : \Aimeos\MShop\Common\Item\Iface |
|
160 | 160 | { |
161 | 161 | $values['cms.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
162 | - return $this->createItemBase( $values ); |
|
162 | + return $this->createItemBase($values); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -171,25 +171,25 @@ discard block |
||
171 | 171 | * @param bool $fetch True if the new ID should be returned in the item |
172 | 172 | * @return \Aimeos\MShop\Cms\Item\Iface Updated item including the generated ID |
173 | 173 | */ |
174 | - public function saveItem( \Aimeos\MShop\Cms\Item\Iface $item, bool $fetch = true ) : \Aimeos\MShop\Cms\Item\Iface |
|
174 | + public function saveItem(\Aimeos\MShop\Cms\Item\Iface $item, bool $fetch = true) : \Aimeos\MShop\Cms\Item\Iface |
|
175 | 175 | { |
176 | - if( !$item->isModified() ) { |
|
177 | - return $this->saveListItems( $item, 'cms', $fetch ); |
|
176 | + if (!$item->isModified()) { |
|
177 | + return $this->saveListItems($item, 'cms', $fetch); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $context = $this->getContext(); |
181 | 181 | |
182 | 182 | $dbm = $context->getDatabaseManager(); |
183 | 183 | $dbname = $this->getResourceName(); |
184 | - $conn = $dbm->acquire( $dbname ); |
|
184 | + $conn = $dbm->acquire($dbname); |
|
185 | 185 | |
186 | 186 | try |
187 | 187 | { |
188 | 188 | $id = $item->getId(); |
189 | - $date = date( 'Y-m-d H:i:s' ); |
|
189 | + $date = date('Y-m-d H:i:s'); |
|
190 | 190 | $columns = $this->getObject()->getSaveAttributes(); |
191 | 191 | |
192 | - if( $id === null ) |
|
192 | + if ($id === null) |
|
193 | 193 | { |
194 | 194 | /** mshop/cms/manager/insert/mysql |
195 | 195 | * Inserts a new cms record into the database table |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @see mshop/cms/manager/count/ansi |
228 | 228 | */ |
229 | 229 | $path = 'mshop/cms/manager/insert'; |
230 | - $sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ) ); |
|
230 | + $sql = $this->addSqlColumns(array_keys($columns), $this->getSqlConfig($path)); |
|
231 | 231 | } |
232 | 232 | else |
233 | 233 | { |
@@ -264,32 +264,32 @@ discard block |
||
264 | 264 | * @see mshop/cms/manager/count/ansi |
265 | 265 | */ |
266 | 266 | $path = 'mshop/cms/manager/update'; |
267 | - $sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ), false ); |
|
267 | + $sql = $this->addSqlColumns(array_keys($columns), $this->getSqlConfig($path), false); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | $idx = 1; |
271 | - $stmt = $this->getCachedStatement( $conn, $path, $sql ); |
|
271 | + $stmt = $this->getCachedStatement($conn, $path, $sql); |
|
272 | 272 | |
273 | - foreach( $columns as $name => $entry ) { |
|
274 | - $stmt->bind( $idx++, $item->get( $name ), $entry->getInternalType() ); |
|
273 | + foreach ($columns as $name => $entry) { |
|
274 | + $stmt->bind($idx++, $item->get($name), $entry->getInternalType()); |
|
275 | 275 | } |
276 | 276 | |
277 | - $stmt->bind( $idx++, $item->getUrl() ); |
|
278 | - $stmt->bind( $idx++, $item->getLabel() ); |
|
279 | - $stmt->bind( $idx++, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
280 | - $stmt->bind( $idx++, $date ); // mtime |
|
281 | - $stmt->bind( $idx++, $context->getEditor() ); |
|
282 | - $stmt->bind( $idx++, $context->getLocale()->getSiteId() ); |
|
277 | + $stmt->bind($idx++, $item->getUrl()); |
|
278 | + $stmt->bind($idx++, $item->getLabel()); |
|
279 | + $stmt->bind($idx++, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
280 | + $stmt->bind($idx++, $date); // mtime |
|
281 | + $stmt->bind($idx++, $context->getEditor()); |
|
282 | + $stmt->bind($idx++, $context->getLocale()->getSiteId()); |
|
283 | 283 | |
284 | - if( $id !== null ) { |
|
285 | - $stmt->bind( $idx++, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
284 | + if ($id !== null) { |
|
285 | + $stmt->bind($idx++, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
286 | 286 | } else { |
287 | - $stmt->bind( $idx++, $date ); // ctime |
|
287 | + $stmt->bind($idx++, $date); // ctime |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | $stmt->execute()->finish(); |
291 | 291 | |
292 | - if( $id === null ) |
|
292 | + if ($id === null) |
|
293 | 293 | { |
294 | 294 | /** mshop/cms/manager/newid/mysql |
295 | 295 | * Retrieves the ID generated by the database when inserting a new record |
@@ -328,20 +328,20 @@ discard block |
||
328 | 328 | * @see mshop/cms/manager/count/ansi |
329 | 329 | */ |
330 | 330 | $path = 'mshop/cms/manager/newid'; |
331 | - $id = $this->newId( $conn, $path ); |
|
331 | + $id = $this->newId($conn, $path); |
|
332 | 332 | } |
333 | 333 | |
334 | - $item->setId( $id ); |
|
334 | + $item->setId($id); |
|
335 | 335 | |
336 | - $dbm->release( $conn, $dbname ); |
|
336 | + $dbm->release($conn, $dbname); |
|
337 | 337 | } |
338 | - catch( \Exception $e ) |
|
338 | + catch (\Exception $e) |
|
339 | 339 | { |
340 | - $dbm->release( $conn, $dbname ); |
|
340 | + $dbm->release($conn, $dbname); |
|
341 | 341 | throw $e; |
342 | 342 | } |
343 | 343 | |
344 | - return $this->saveListItems( $item, 'cms', $fetch ); |
|
344 | + return $this->saveListItems($item, 'cms', $fetch); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @param \Aimeos\MShop\Common\Item\Iface[]|string[] $itemIds List of item objects or IDs of the items |
352 | 352 | * @return \Aimeos\MShop\Cms\Manager\Iface Manager object for chaining method calls |
353 | 353 | */ |
354 | - public function delete( $itemIds ) : \Aimeos\MShop\Common\Manager\Iface |
|
354 | + public function delete($itemIds) : \Aimeos\MShop\Common\Manager\Iface |
|
355 | 355 | { |
356 | 356 | /** mshop/cms/manager/delete/mysql |
357 | 357 | * Deletes the items matched by the given IDs from the database |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | */ |
386 | 386 | $path = 'mshop/cms/manager/delete'; |
387 | 387 | |
388 | - return $this->deleteItemsBase( $itemIds, $path )->deleteRefItems( $itemIds ); |
|
388 | + return $this->deleteItemsBase($itemIds, $path)->deleteRefItems($itemIds); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | * @param bool $default True to add default criteria |
400 | 400 | * @return \Aimeos\MShop\Common\Item\Iface Item object |
401 | 401 | */ |
402 | - public function find( string $code, array $ref = [], string $domain = null, string $type = null, |
|
403 | - bool $default = false ) : \Aimeos\MShop\Common\Item\Iface |
|
402 | + public function find(string $code, array $ref = [], string $domain = null, string $type = null, |
|
403 | + bool $default = false) : \Aimeos\MShop\Common\Item\Iface |
|
404 | 404 | { |
405 | - return $this->findBase( array( 'cms.url' => $code ), $ref, $default ); |
|
405 | + return $this->findBase(array('cms.url' => $code), $ref, $default); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | * @return \Aimeos\MShop\Cms\Item\Iface Returns the cms item of the given id |
416 | 416 | * @throws \Aimeos\MShop\Exception If item couldn't be found |
417 | 417 | */ |
418 | - public function get( string $id, array $ref = [], bool $default = false ) : \Aimeos\MShop\Common\Item\Iface |
|
418 | + public function get(string $id, array $ref = [], bool $default = false) : \Aimeos\MShop\Common\Item\Iface |
|
419 | 419 | { |
420 | - return $this->getItemBase( 'cms.id', $id, $ref, $default ); |
|
420 | + return $this->getItemBase('cms.id', $id, $ref, $default); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | |
@@ -427,10 +427,10 @@ discard block |
||
427 | 427 | * @param bool $withsub Return also the resource type of sub-managers if true |
428 | 428 | * @return string[] Type of the manager and submanagers, subtypes are separated by slashes |
429 | 429 | */ |
430 | - public function getResourceType( bool $withsub = true ) : array |
|
430 | + public function getResourceType(bool $withsub = true) : array |
|
431 | 431 | { |
432 | 432 | $path = 'mshop/cms/manager/submanagers'; |
433 | - return $this->getResourceTypeBase( 'cms', $path, ['lists'], $withsub ); |
|
433 | + return $this->getResourceTypeBase('cms', $path, ['lists'], $withsub); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | * @param bool $withsub Return also attributes of sub-managers if true |
441 | 441 | * @return \Aimeos\MW\Criteria\Attribute\Iface[] List of search attribute items |
442 | 442 | */ |
443 | - public function getSearchAttributes( bool $withsub = true ) : array |
|
443 | + public function getSearchAttributes(bool $withsub = true) : array |
|
444 | 444 | { |
445 | 445 | /** mshop/cms/manager/submanagers |
446 | 446 | * List of manager names that can be instantiated by the cms manager |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | */ |
462 | 462 | $path = 'mshop/cms/manager/submanagers'; |
463 | 463 | |
464 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
|
464 | + return $this->getSearchAttributesBase($this->searchConfig, $path, [], $withsub); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
@@ -473,18 +473,18 @@ discard block |
||
473 | 473 | * @param int|null &$total Number of items that are available in total |
474 | 474 | * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Cms\Item\Iface with ids as keys |
475 | 475 | */ |
476 | - public function search( \Aimeos\MW\Criteria\Iface $search, array $ref = [], int &$total = null ) : \Aimeos\Map |
|
476 | + public function search(\Aimeos\MW\Criteria\Iface $search, array $ref = [], int &$total = null) : \Aimeos\Map |
|
477 | 477 | { |
478 | 478 | $map = []; |
479 | 479 | $context = $this->getContext(); |
480 | 480 | |
481 | 481 | $dbm = $context->getDatabaseManager(); |
482 | 482 | $dbname = $this->getResourceName(); |
483 | - $conn = $dbm->acquire( $dbname ); |
|
483 | + $conn = $dbm->acquire($dbname); |
|
484 | 484 | |
485 | 485 | try |
486 | 486 | { |
487 | - $required = array( 'cms' ); |
|
487 | + $required = array('cms'); |
|
488 | 488 | |
489 | 489 | /** mshop/cms/manager/sitemode |
490 | 490 | * Mode how items from levels below or above in the site tree are handled |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @see mshop/locale/manager/sitelevel |
517 | 517 | */ |
518 | 518 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ONE; |
519 | - $level = $context->getConfig()->get( 'mshop/cms/manager/sitemode', $level ); |
|
519 | + $level = $context->getConfig()->get('mshop/cms/manager/sitemode', $level); |
|
520 | 520 | |
521 | 521 | /** mshop/cms/manager/search/mysql |
522 | 522 | * Retrieves the records matched by the given criteria in the database |
@@ -630,21 +630,21 @@ discard block |
||
630 | 630 | */ |
631 | 631 | $cfgPathCount = 'mshop/cms/manager/count'; |
632 | 632 | |
633 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
633 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
634 | 634 | |
635 | - while( ( $row = $results->fetch() ) !== null ) { |
|
635 | + while (($row = $results->fetch()) !== null) { |
|
636 | 636 | $map[$row['cms.id']] = $row; |
637 | 637 | } |
638 | 638 | |
639 | - $dbm->release( $conn, $dbname ); |
|
639 | + $dbm->release($conn, $dbname); |
|
640 | 640 | } |
641 | - catch( \Exception $e ) |
|
641 | + catch (\Exception $e) |
|
642 | 642 | { |
643 | - $dbm->release( $conn, $dbname ); |
|
643 | + $dbm->release($conn, $dbname); |
|
644 | 644 | throw $e; |
645 | 645 | } |
646 | 646 | |
647 | - return $this->buildItems( $map, $ref, 'cms' ); |
|
647 | + return $this->buildItems($map, $ref, 'cms'); |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | |
@@ -655,9 +655,9 @@ discard block |
||
655 | 655 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
656 | 656 | * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g types, lists etc. |
657 | 657 | */ |
658 | - public function getSubManager( string $manager, string $name = null ) : \Aimeos\MShop\Common\Manager\Iface |
|
658 | + public function getSubManager(string $manager, string $name = null) : \Aimeos\MShop\Common\Manager\Iface |
|
659 | 659 | { |
660 | - return $this->getSubManagerBase( 'cms', $manager, $name ); |
|
660 | + return $this->getSubManagerBase('cms', $manager, $name); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | |
@@ -668,10 +668,10 @@ discard block |
||
668 | 668 | * @param bool $site TRUE for adding site criteria to limit items by the site of related items |
669 | 669 | * @return \Aimeos\MW\Criteria\Iface Returns the filter object |
670 | 670 | */ |
671 | - public function filter( bool $default = false, bool $site = false ) : \Aimeos\MW\Criteria\Iface |
|
671 | + public function filter(bool $default = false, bool $site = false) : \Aimeos\MW\Criteria\Iface |
|
672 | 672 | { |
673 | - if( $default === true ) { |
|
674 | - return $this->filterBase( 'cms' ); |
|
673 | + if ($default === true) { |
|
674 | + return $this->filterBase('cms'); |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | return parent::filter(); |
@@ -686,8 +686,8 @@ discard block |
||
686 | 686 | * @param \Aimeos\MShop\Common\Item\Iface $refItems List of referenced items |
687 | 687 | * @return \Aimeos\MShop\Cms\Item\Iface New cms item |
688 | 688 | */ |
689 | - protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [] ) : \Aimeos\MShop\Common\Item\Iface |
|
689 | + protected function createItemBase(array $values = [], array $listItems = [], array $refItems = []) : \Aimeos\MShop\Common\Item\Iface |
|
690 | 690 | { |
691 | - return new \Aimeos\MShop\Cms\Item\Standard( $values, $listItems, $refItems ); |
|
691 | + return new \Aimeos\MShop\Cms\Item\Standard($values, $listItems, $refItems); |
|
692 | 692 | } |
693 | 693 | } |
@@ -228,8 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | $path = 'mshop/cms/manager/insert'; |
230 | 230 | $sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ) ); |
231 | - } |
|
232 | - else |
|
231 | + } else |
|
233 | 232 | { |
234 | 233 | /** mshop/cms/manager/update/mysql |
235 | 234 | * Updates an existing cms record in the database |
@@ -334,8 +333,7 @@ discard block |
||
334 | 333 | $item->setId( $id ); |
335 | 334 | |
336 | 335 | $dbm->release( $conn, $dbname ); |
337 | - } |
|
338 | - catch( \Exception $e ) |
|
336 | + } catch( \Exception $e ) |
|
339 | 337 | { |
340 | 338 | $dbm->release( $conn, $dbname ); |
341 | 339 | throw $e; |
@@ -637,8 +635,7 @@ discard block |
||
637 | 635 | } |
638 | 636 | |
639 | 637 | $dbm->release( $conn, $dbname ); |
640 | - } |
|
641 | - catch( \Exception $e ) |
|
638 | + } catch( \Exception $e ) |
|
642 | 639 | { |
643 | 640 | $dbm->release( $conn, $dbname ); |
644 | 641 | throw $e; |