@@ -21,70 +21,70 @@ discard block |
||
21 | 21 | $this->view = \TestHelperJqadm::getView(); |
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | |
24 | - $this->object = new \Aimeos\Admin\JQAdm\Catalog\Media\Standard( $this->context ); |
|
25 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
26 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
27 | - $this->object->setView( $this->view ); |
|
24 | + $this->object = new \Aimeos\Admin\JQAdm\Catalog\Media\Standard($this->context); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
26 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
27 | + $this->object->setView($this->view); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function tearDown() |
32 | 32 | { |
33 | - unset( $this->object, $this->view, $this->context ); |
|
33 | + unset($this->object, $this->view, $this->context); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testCreate() |
38 | 38 | { |
39 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
39 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
40 | 40 | |
41 | 41 | $this->view->item = $manager->createItem(); |
42 | 42 | $result = $this->object->create(); |
43 | 43 | |
44 | - $this->assertContains( 'item-media', $result ); |
|
45 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
44 | + $this->assertContains('item-media', $result); |
|
45 | + $this->assertNull($this->view->get('errors')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testCopy() |
50 | 50 | { |
51 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
51 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
52 | 52 | |
53 | - $this->view->item = $manager->findItem( 'cafe', ['media'] ); |
|
53 | + $this->view->item = $manager->findItem('cafe', ['media']); |
|
54 | 54 | $result = $this->object->copy(); |
55 | 55 | |
56 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
57 | - $this->assertContains( '"media.preview":"prod_123x103\/195_prod_123x103.jpg"', $result ); |
|
56 | + $this->assertNull($this->view->get('errors')); |
|
57 | + $this->assertContains('"media.preview":"prod_123x103\/195_prod_123x103.jpg"', $result); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | public function testDelete() |
62 | 62 | { |
63 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
63 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
64 | 64 | |
65 | 65 | $this->view->item = $manager->createItem(); |
66 | 66 | $result = $this->object->delete(); |
67 | 67 | |
68 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
69 | - $this->assertNull( $result ); |
|
68 | + $this->assertNull($this->view->get('errors')); |
|
69 | + $this->assertNull($result); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
73 | 73 | public function testGet() |
74 | 74 | { |
75 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
75 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
76 | 76 | |
77 | - $this->view->item = $manager->findItem( 'cafe', ['media'] ); |
|
77 | + $this->view->item = $manager->findItem('cafe', ['media']); |
|
78 | 78 | $result = $this->object->get(); |
79 | 79 | |
80 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
81 | - $this->assertContains( '"media.preview":"prod_123x103\/195_prod_123x103.jpg"', $result ); |
|
80 | + $this->assertNull($this->view->get('errors')); |
|
81 | + $this->assertContains('"media.preview":"prod_123x103\/195_prod_123x103.jpg"', $result); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | 85 | public function testSave() |
86 | 86 | { |
87 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
87 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
88 | 88 | $this->view->item = $manager->createItem(); |
89 | 89 | |
90 | 90 | $param = array( |
@@ -98,108 +98,108 @@ discard block |
||
98 | 98 | ]], |
99 | 99 | ); |
100 | 100 | |
101 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
102 | - $this->view->addHelper( 'param', $helper ); |
|
101 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
102 | + $this->view->addHelper('param', $helper); |
|
103 | 103 | |
104 | - $file = $this->getMockBuilder( \Psr\Http\Message\UploadedFileInterface::class )->getMock(); |
|
105 | - $request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock(); |
|
106 | - $request->expects( $this->any() )->method( 'getUploadedFiles' ) |
|
107 | - ->will( $this->returnValue( ['media' => [0 => ['file' => $file] ] ] ) ); |
|
104 | + $file = $this->getMockBuilder(\Psr\Http\Message\UploadedFileInterface::class)->getMock(); |
|
105 | + $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock(); |
|
106 | + $request->expects($this->any())->method('getUploadedFiles') |
|
107 | + ->will($this->returnValue(['media' => [0 => ['file' => $file]]])); |
|
108 | 108 | |
109 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
110 | - $this->view ->addHelper( 'request', $helper ); |
|
109 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
110 | + $this->view ->addHelper('request', $helper); |
|
111 | 111 | |
112 | 112 | |
113 | 113 | $name = 'AdminJQAdmCatalogMediaSave'; |
114 | - $this->context->getConfig()->set( 'controller/common/media/name', $name ); |
|
114 | + $this->context->getConfig()->set('controller/common/media/name', $name); |
|
115 | 115 | |
116 | - $cntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Media\\Standard' ) |
|
117 | - ->setConstructorArgs( array( $this->context ) ) |
|
118 | - ->setMethods( array( 'add' ) ) |
|
116 | + $cntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Media\\Standard') |
|
117 | + ->setConstructorArgs(array($this->context)) |
|
118 | + ->setMethods(array('add')) |
|
119 | 119 | ->getMock(); |
120 | 120 | |
121 | - \Aimeos\Controller\Common\Media\Factory::injectController( '\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub ); |
|
121 | + \Aimeos\Controller\Common\Media\Factory::injectController('\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub); |
|
122 | 122 | |
123 | - $cntlStub->expects( $this->once() )->method( 'add' ); |
|
123 | + $cntlStub->expects($this->once())->method('add'); |
|
124 | 124 | |
125 | 125 | |
126 | 126 | $result = $this->object->save(); |
127 | 127 | |
128 | 128 | |
129 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
130 | - $this->assertNull( $result ); |
|
131 | - $this->assertEquals( 1, count( $this->view->item->getListItems() ) ); |
|
129 | + $this->assertNull($this->view->get('errors')); |
|
130 | + $this->assertNull($result); |
|
131 | + $this->assertEquals(1, count($this->view->item->getListItems())); |
|
132 | 132 | |
133 | - foreach( $this->view->item->getListItems( 'media' ) as $listItem ) |
|
133 | + foreach ($this->view->item->getListItems('media') as $listItem) |
|
134 | 134 | { |
135 | - $this->assertEquals( 'media', $listItem->getDomain() ); |
|
135 | + $this->assertEquals('media', $listItem->getDomain()); |
|
136 | 136 | |
137 | 137 | $refItem = $listItem->getRefItem(); |
138 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
139 | - $this->assertEquals( 'test', $refItem->getLabel() ); |
|
138 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
139 | + $this->assertEquals('test', $refItem->getLabel()); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, ['site' => 'unittest', 'media' => []] ); |
|
144 | - $this->view->addHelper( 'param', $helper ); |
|
143 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, ['site' => 'unittest', 'media' => []]); |
|
144 | + $this->view->addHelper('param', $helper); |
|
145 | 145 | |
146 | 146 | $result = $this->object->save(); |
147 | 147 | |
148 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
149 | - $this->assertNull( $result ); |
|
150 | - $this->assertEquals( 0, count( $this->view->item->getListItems() ) ); |
|
148 | + $this->assertNull($this->view->get('errors')); |
|
149 | + $this->assertNull($result); |
|
150 | + $this->assertEquals(0, count($this->view->item->getListItems())); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | public function testSaveException() |
155 | 155 | { |
156 | - $object = $this->getClientMock( 'fromArray' ); |
|
156 | + $object = $this->getClientMock('fromArray'); |
|
157 | 157 | |
158 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
159 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
158 | + $object->expects($this->once())->method('fromArray') |
|
159 | + ->will($this->throwException(new \RuntimeException())); |
|
160 | 160 | |
161 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
161 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
162 | 162 | $object->save(); |
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | public function testSaveMShopException() |
167 | 167 | { |
168 | - $object = $this->getClientMock( 'fromArray' ); |
|
168 | + $object = $this->getClientMock('fromArray'); |
|
169 | 169 | |
170 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
171 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
170 | + $object->expects($this->once())->method('fromArray') |
|
171 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
172 | 172 | |
173 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
173 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
174 | 174 | $object->save(); |
175 | 175 | } |
176 | 176 | |
177 | 177 | |
178 | 178 | public function testSearch() |
179 | 179 | { |
180 | - $this->assertNull( $this->object->search() ); |
|
180 | + $this->assertNull($this->object->search()); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | 184 | public function testGetSubClient() |
185 | 185 | { |
186 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
187 | - $this->object->getSubClient( 'unknown' ); |
|
186 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
187 | + $this->object->getSubClient('unknown'); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
191 | - public function getClientMock( $method ) |
|
191 | + public function getClientMock($method) |
|
192 | 192 | { |
193 | - $object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Catalog\Media\Standard::class ) |
|
194 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
195 | - ->setMethods( [$method] ) |
|
193 | + $object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Catalog\Media\Standard::class) |
|
194 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
195 | + ->setMethods([$method]) |
|
196 | 196 | ->getMock(); |
197 | 197 | |
198 | 198 | $view = \TestHelperJqadm::getView(); |
199 | - $view->item = \Aimeos\MShop::create( $this->context, 'catalog' )->createItem(); |
|
199 | + $view->item = \Aimeos\MShop::create($this->context, 'catalog')->createItem(); |
|
200 | 200 | |
201 | - $object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
202 | - $object->setView( $view ); |
|
201 | + $object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
202 | + $object->setView($view); |
|
203 | 203 | |
204 | 204 | return $object; |
205 | 205 | } |
@@ -21,40 +21,40 @@ discard block |
||
21 | 21 | $this->view = \TestHelperJqadm::getView(); |
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | |
24 | - $this->object = new \Aimeos\Admin\JQAdm\Catalog\Media\Property\Standard( $this->context ); |
|
25 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
26 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
27 | - $this->object->setView( $this->view ); |
|
24 | + $this->object = new \Aimeos\Admin\JQAdm\Catalog\Media\Property\Standard($this->context); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
26 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
27 | + $this->object->setView($this->view); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function tearDown() |
32 | 32 | { |
33 | - unset( $this->object, $this->view, $this->context ); |
|
33 | + unset($this->object, $this->view, $this->context); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testCreate() |
38 | 38 | { |
39 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
39 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
40 | 40 | |
41 | 41 | $this->view->item = $manager->createItem(); |
42 | 42 | $result = $this->object->create(); |
43 | 43 | |
44 | - $this->assertContains( 'Media properties', $result ); |
|
45 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
44 | + $this->assertContains('Media properties', $result); |
|
45 | + $this->assertNull($this->view->get('errors')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testCopy() |
50 | 50 | { |
51 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
51 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
52 | 52 | |
53 | - $this->view->item = $manager->findItem( 'cafe', ['media'] ); |
|
53 | + $this->view->item = $manager->findItem('cafe', ['media']); |
|
54 | 54 | $result = $this->object->copy(); |
55 | 55 | |
56 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
57 | - $this->assertContains( 'item-media-property', $result ); |
|
56 | + $this->assertNull($this->view->get('errors')); |
|
57 | + $this->assertContains('item-media-property', $result); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -62,33 +62,33 @@ discard block |
||
62 | 62 | { |
63 | 63 | $result = $this->object->delete(); |
64 | 64 | |
65 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
66 | - $this->assertNull( $result ); |
|
65 | + $this->assertNull($this->view->get('errors')); |
|
66 | + $this->assertNull($result); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
70 | 70 | public function testGet() |
71 | 71 | { |
72 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
72 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
73 | 73 | |
74 | - $this->view->item = $manager->findItem( 'cafe', ['media'] ); |
|
74 | + $this->view->item = $manager->findItem('cafe', ['media']); |
|
75 | 75 | $result = $this->object->get(); |
76 | 76 | |
77 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
78 | - $this->assertContains( 'item-media-property', $result ); |
|
77 | + $this->assertNull($this->view->get('errors')); |
|
78 | + $this->assertContains('item-media-property', $result); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
82 | 82 | public function testSave() |
83 | 83 | { |
84 | - $manager = \Aimeos\MShop::create( $this->context, 'catalog' ); |
|
85 | - $typeManager = \Aimeos\MShop::create( $this->context, 'media/property/type' ); |
|
84 | + $manager = \Aimeos\MShop::create($this->context, 'catalog'); |
|
85 | + $typeManager = \Aimeos\MShop::create($this->context, 'media/property/type'); |
|
86 | 86 | |
87 | - $item = $manager->findItem( 'cafe', ['media'] ); |
|
88 | - $item->setCode( 'jqadm-test-media-property' ); |
|
89 | - $item->setId( null ); |
|
87 | + $item = $manager->findItem('cafe', ['media']); |
|
88 | + $item->setCode('jqadm-test-media-property'); |
|
89 | + $item->setId(null); |
|
90 | 90 | |
91 | - $this->view->item = $manager->insertItem( $item ); |
|
91 | + $this->view->item = $manager->insertItem($item); |
|
92 | 92 | |
93 | 93 | $param = array( |
94 | 94 | 'site' => 'unittest', |
@@ -104,53 +104,53 @@ discard block |
||
104 | 104 | ), |
105 | 105 | ); |
106 | 106 | |
107 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
108 | - $this->view->addHelper( 'param', $helper ); |
|
107 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
108 | + $this->view->addHelper('param', $helper); |
|
109 | 109 | |
110 | 110 | |
111 | 111 | $result = $this->object->save(); |
112 | 112 | |
113 | 113 | |
114 | - $manager->deleteItem( $this->view->item->getId() ); |
|
114 | + $manager->deleteItem($this->view->item->getId()); |
|
115 | 115 | |
116 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
117 | - $this->assertNull( $result ); |
|
116 | + $this->assertNull($this->view->get('errors')); |
|
117 | + $this->assertNull($result); |
|
118 | 118 | |
119 | - $mediaItems = $this->view->item->getRefItems( 'media' ); |
|
120 | - $this->assertEquals( 2, count( $mediaItems ) ); |
|
121 | - $this->assertEquals( 1, count( reset( $mediaItems )->getPropertyItems() ) ); |
|
119 | + $mediaItems = $this->view->item->getRefItems('media'); |
|
120 | + $this->assertEquals(2, count($mediaItems)); |
|
121 | + $this->assertEquals(1, count(reset($mediaItems)->getPropertyItems())); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
125 | 125 | public function testSaveException() |
126 | 126 | { |
127 | - $object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Catalog\Media\Property\Standard::class ) |
|
128 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
129 | - ->setMethods( array( 'fromArray' ) ) |
|
127 | + $object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Catalog\Media\Property\Standard::class) |
|
128 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
129 | + ->setMethods(array('fromArray')) |
|
130 | 130 | ->getMock(); |
131 | 131 | |
132 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
133 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
132 | + $object->expects($this->once())->method('fromArray') |
|
133 | + ->will($this->throwException(new \RuntimeException())); |
|
134 | 134 | |
135 | 135 | $this->view = \TestHelperJqadm::getView(); |
136 | - $this->view->item = \Aimeos\MShop::create( $this->context, 'catalog' )->createItem(); |
|
136 | + $this->view->item = \Aimeos\MShop::create($this->context, 'catalog')->createItem(); |
|
137 | 137 | |
138 | - $object->setView( $this->view ); |
|
138 | + $object->setView($this->view); |
|
139 | 139 | |
140 | - $this->setExpectedException( \RuntimeException::class ); |
|
140 | + $this->setExpectedException(\RuntimeException::class); |
|
141 | 141 | $object->save(); |
142 | 142 | } |
143 | 143 | |
144 | 144 | |
145 | 145 | public function testSearch() |
146 | 146 | { |
147 | - $this->assertNull( $this->object->search() ); |
|
147 | + $this->assertNull($this->object->search()); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
151 | 151 | public function testGetSubClient() |
152 | 152 | { |
153 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
154 | - $this->object->getSubClient( 'unknown' ); |
|
153 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
154 | + $this->object->getSubClient('unknown'); |
|
155 | 155 | } |
156 | 156 | } |
@@ -17,42 +17,42 @@ |
||
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | 19 | $this->context = \TestHelperJqadm::getContext(); |
20 | - $this->context->setView( \TestHelperJqadm::getView() ); |
|
20 | + $this->context->setView(\TestHelperJqadm::getView()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | public function testCreateClient() |
25 | 25 | { |
26 | - $client = \Aimeos\Admin\JQAdm\Service\Factory::create( $this->context ); |
|
27 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
26 | + $client = \Aimeos\Admin\JQAdm\Service\Factory::create($this->context); |
|
27 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testCreateClientName() |
32 | 32 | { |
33 | - $client = \Aimeos\Admin\JQAdm\Service\Factory::create( $this->context, 'Standard' ); |
|
34 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
33 | + $client = \Aimeos\Admin\JQAdm\Service\Factory::create($this->context, 'Standard'); |
|
34 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testCreateClientNameEmpty() |
39 | 39 | { |
40 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
41 | - \Aimeos\Admin\JQAdm\Service\Factory::create( $this->context, '' ); |
|
40 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
41 | + \Aimeos\Admin\JQAdm\Service\Factory::create($this->context, ''); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testCreateClientNameInvalid() |
46 | 46 | { |
47 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
48 | - \Aimeos\Admin\JQAdm\Service\Factory::create( $this->context, '%service' ); |
|
47 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
48 | + \Aimeos\Admin\JQAdm\Service\Factory::create($this->context, '%service'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | public function testCreateClientNameNotFound() |
53 | 53 | { |
54 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
55 | - \Aimeos\Admin\JQAdm\Service\Factory::create( $this->context, 'test' ); |
|
54 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
55 | + \Aimeos\Admin\JQAdm\Service\Factory::create($this->context, 'test'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | } |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | protected function setUp() |
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\Service\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\Service\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() |
36 | 36 | { |
37 | - unset( $this->object, $this->view, $this->context ); |
|
37 | + unset($this->object, $this->view, $this->context); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | |
47 | 47 | public function testCreateException() |
48 | 48 | { |
49 | - $object = $this->getClientMock( 'getSubClients' ); |
|
49 | + $object = $this->getClientMock('getSubClients'); |
|
50 | 50 | |
51 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
52 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
51 | + $object->expects($this->once())->method('getSubClients') |
|
52 | + ->will($this->throwException(new \RuntimeException())); |
|
53 | 53 | |
54 | 54 | $object->create(); |
55 | 55 | } |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | public function testCreateMShopException() |
59 | 59 | { |
60 | - $object = $this->getClientMock( 'getSubClients' ); |
|
60 | + $object = $this->getClientMock('getSubClients'); |
|
61 | 61 | |
62 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
63 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
62 | + $object->expects($this->once())->method('getSubClients') |
|
63 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
64 | 64 | |
65 | 65 | $object->create(); |
66 | 66 | } |
@@ -68,24 +68,24 @@ discard block |
||
68 | 68 | |
69 | 69 | public function testCopy() |
70 | 70 | { |
71 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
71 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
72 | 72 | |
73 | - $param = ['site' => 'unittest', 'id' => $manager->findItem( 'unitpaymentcode' )->getId()]; |
|
74 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
75 | - $this->view->addHelper( 'param', $helper ); |
|
73 | + $param = ['site' => 'unittest', 'id' => $manager->findItem('unitpaymentcode')->getId()]; |
|
74 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
75 | + $this->view->addHelper('param', $helper); |
|
76 | 76 | |
77 | 77 | $result = $this->object->copy(); |
78 | 78 | |
79 | - $this->assertContains( 'unitpaymentcode_copy', $result ); |
|
79 | + $this->assertContains('unitpaymentcode_copy', $result); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | 83 | public function testCopyException() |
84 | 84 | { |
85 | - $object = $this->getClientMock( 'getSubClients' ); |
|
85 | + $object = $this->getClientMock('getSubClients'); |
|
86 | 86 | |
87 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
88 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
87 | + $object->expects($this->once())->method('getSubClients') |
|
88 | + ->will($this->throwException(new \RuntimeException())); |
|
89 | 89 | |
90 | 90 | $object->copy(); |
91 | 91 | } |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | |
94 | 94 | public function testCopyMShopException() |
95 | 95 | { |
96 | - $object = $this->getClientMock( 'getSubClients' ); |
|
96 | + $object = $this->getClientMock('getSubClients'); |
|
97 | 97 | |
98 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
99 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
98 | + $object->expects($this->once())->method('getSubClients') |
|
99 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
100 | 100 | |
101 | 101 | $object->copy(); |
102 | 102 | } |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | |
105 | 105 | public function testDelete() |
106 | 106 | { |
107 | - $this->assertNotNull( $this->object->delete() ); |
|
107 | + $this->assertNotNull($this->object->delete()); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | 111 | public function testDeleteException() |
112 | 112 | { |
113 | - $object = $this->getClientMock( 'getSubClients' ); |
|
113 | + $object = $this->getClientMock('getSubClients'); |
|
114 | 114 | |
115 | - $object->expects( $this->exactly( 2 ) )->method( 'getSubClients' ) |
|
116 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
115 | + $object->expects($this->exactly(2))->method('getSubClients') |
|
116 | + ->will($this->throwException(new \RuntimeException())); |
|
117 | 117 | |
118 | 118 | $object->delete(); |
119 | 119 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | |
122 | 122 | public function testDeleteMShopException() |
123 | 123 | { |
124 | - $object = $this->getClientMock( 'getSubClients' ); |
|
124 | + $object = $this->getClientMock('getSubClients'); |
|
125 | 125 | |
126 | - $object->expects( $this->exactly( 2 ) )->method( 'getSubClients' ) |
|
127 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
126 | + $object->expects($this->exactly(2))->method('getSubClients') |
|
127 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
128 | 128 | |
129 | 129 | $object->delete(); |
130 | 130 | } |
@@ -132,24 +132,24 @@ discard block |
||
132 | 132 | |
133 | 133 | public function testGet() |
134 | 134 | { |
135 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
135 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
136 | 136 | |
137 | - $param = ['site' => 'unittest', 'id' => $manager->findItem( 'unitpaymentcode' )->getId()]; |
|
138 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
139 | - $this->view->addHelper( 'param', $helper ); |
|
137 | + $param = ['site' => 'unittest', 'id' => $manager->findItem('unitpaymentcode')->getId()]; |
|
138 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
139 | + $this->view->addHelper('param', $helper); |
|
140 | 140 | |
141 | 141 | $result = $this->object->get(); |
142 | 142 | |
143 | - $this->assertContains( 'unitpaymentlabel', $result ); |
|
143 | + $this->assertContains('unitpaymentlabel', $result); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
147 | 147 | public function testGetException() |
148 | 148 | { |
149 | - $object = $this->getClientMock( 'getSubClients' ); |
|
149 | + $object = $this->getClientMock('getSubClients'); |
|
150 | 150 | |
151 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
152 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
151 | + $object->expects($this->once())->method('getSubClients') |
|
152 | + ->will($this->throwException(new \RuntimeException())); |
|
153 | 153 | |
154 | 154 | $object->get(); |
155 | 155 | } |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | |
158 | 158 | public function testGetMShopException() |
159 | 159 | { |
160 | - $object = $this->getClientMock( 'getSubClients' ); |
|
160 | + $object = $this->getClientMock('getSubClients'); |
|
161 | 161 | |
162 | - $object->expects( $this->once() )->method( 'getSubClients' ) |
|
163 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
162 | + $object->expects($this->once())->method('getSubClients') |
|
163 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
164 | 164 | |
165 | 165 | $object->get(); |
166 | 166 | } |
@@ -168,16 +168,16 @@ discard block |
||
168 | 168 | |
169 | 169 | public function testGetViewException() |
170 | 170 | { |
171 | - $object = new \Aimeos\Admin\JQAdm\Service\Standard( $this->context, [] ); |
|
171 | + $object = new \Aimeos\Admin\JQAdm\Service\Standard($this->context, []); |
|
172 | 172 | |
173 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
173 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
174 | 174 | $object->getView(); |
175 | 175 | } |
176 | 176 | |
177 | 177 | |
178 | 178 | public function testSave() |
179 | 179 | { |
180 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
180 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
181 | 181 | |
182 | 182 | $param = array( |
183 | 183 | 'site' => 'unittest', |
@@ -191,27 +191,27 @@ discard block |
||
191 | 191 | 'service.dateend' => null, |
192 | 192 | 'service.position' => '2', |
193 | 193 | 'config' => array( |
194 | - 'key' => array( 0 => 'test key' ), |
|
195 | - 'val' => array( 0 => 'test value' ), |
|
194 | + 'key' => array(0 => 'test key'), |
|
195 | + 'val' => array(0 => 'test value'), |
|
196 | 196 | ), |
197 | 197 | ), |
198 | 198 | ); |
199 | 199 | |
200 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
201 | - $this->view->addHelper( 'param', $helper ); |
|
200 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
201 | + $this->view->addHelper('param', $helper); |
|
202 | 202 | |
203 | 203 | $this->object->save(); |
204 | 204 | |
205 | - $manager->deleteItem( $manager->findItem( 'test' )->getId() ); |
|
205 | + $manager->deleteItem($manager->findItem('test')->getId()); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
209 | 209 | public function testSaveException() |
210 | 210 | { |
211 | - $object = $this->getClientMock( 'fromArray' ); |
|
211 | + $object = $this->getClientMock('fromArray'); |
|
212 | 212 | |
213 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
214 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
213 | + $object->expects($this->once())->method('fromArray') |
|
214 | + ->will($this->throwException(new \RuntimeException())); |
|
215 | 215 | |
216 | 216 | $object->save(); |
217 | 217 | } |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | |
220 | 220 | public function testSaveMShopException() |
221 | 221 | { |
222 | - $object = $this->getClientMock( 'fromArray' ); |
|
222 | + $object = $this->getClientMock('fromArray'); |
|
223 | 223 | |
224 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
225 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
224 | + $object->expects($this->once())->method('fromArray') |
|
225 | + ->will($this->throwException(new \RuntimeException())); |
|
226 | 226 | |
227 | 227 | $object->save(); |
228 | 228 | } |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | |
231 | 231 | public function testSaveJQAdmException() |
232 | 232 | { |
233 | - $object = $this->getClientMock( 'fromArray' ); |
|
233 | + $object = $this->getClientMock('fromArray'); |
|
234 | 234 | |
235 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
236 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
235 | + $object->expects($this->once())->method('fromArray') |
|
236 | + ->will($this->throwException(new \RuntimeException())); |
|
237 | 237 | |
238 | 238 | $object->save(); |
239 | 239 | } |
@@ -244,27 +244,27 @@ discard block |
||
244 | 244 | $param = array( |
245 | 245 | 'site' => 'unittest', 'lang' => 'de', |
246 | 246 | 'filter' => array( |
247 | - 'key' => array( 0 => 'service.code' ), |
|
248 | - 'op' => array( 0 => '==' ), |
|
249 | - 'val' => array( 0 => 'unitpaymentcode' ), |
|
247 | + 'key' => array(0 => 'service.code'), |
|
248 | + 'op' => array(0 => '=='), |
|
249 | + 'val' => array(0 => 'unitpaymentcode'), |
|
250 | 250 | ), |
251 | - 'sort' => array( 'service.label', '-service.id' ), |
|
251 | + 'sort' => array('service.label', '-service.id'), |
|
252 | 252 | ); |
253 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
254 | - $this->view->addHelper( 'param', $helper ); |
|
253 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
254 | + $this->view->addHelper('param', $helper); |
|
255 | 255 | |
256 | 256 | $result = $this->object->search(); |
257 | 257 | |
258 | - $this->assertContains( '>unitpaymentlabel<', $result ); |
|
258 | + $this->assertContains('>unitpaymentlabel<', $result); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
262 | 262 | public function testSearchException() |
263 | 263 | { |
264 | - $object = $this->getClientMock( 'initCriteria' ); |
|
264 | + $object = $this->getClientMock('initCriteria'); |
|
265 | 265 | |
266 | - $object->expects( $this->once() )->method( 'initCriteria' ) |
|
267 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
266 | + $object->expects($this->once())->method('initCriteria') |
|
267 | + ->will($this->throwException(new \RuntimeException())); |
|
268 | 268 | |
269 | 269 | $object->search(); |
270 | 270 | } |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | |
273 | 273 | public function testSearchMShopException() |
274 | 274 | { |
275 | - $object = $this->getClientMock( 'initCriteria' ); |
|
275 | + $object = $this->getClientMock('initCriteria'); |
|
276 | 276 | |
277 | - $object->expects( $this->once() )->method( 'initCriteria' ) |
|
278 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
277 | + $object->expects($this->once())->method('initCriteria') |
|
278 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
279 | 279 | |
280 | 280 | $object->search(); |
281 | 281 | } |
@@ -283,34 +283,34 @@ discard block |
||
283 | 283 | |
284 | 284 | public function testGetSubClient() |
285 | 285 | { |
286 | - $result = $this->object->getSubClient( 'media' ); |
|
287 | - $this->assertInstanceOf( \Aimeos\Admin\JQAdm\Iface::class, $result ); |
|
286 | + $result = $this->object->getSubClient('media'); |
|
287 | + $this->assertInstanceOf(\Aimeos\Admin\JQAdm\Iface::class, $result); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
291 | 291 | public function testGetSubClientInvalid() |
292 | 292 | { |
293 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
294 | - $this->object->getSubClient( '$unknown$' ); |
|
293 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
294 | + $this->object->getSubClient('$unknown$'); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
298 | 298 | public function testGetSubClientUnknown() |
299 | 299 | { |
300 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
301 | - $this->object->getSubClient( 'unknown' ); |
|
300 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
301 | + $this->object->getSubClient('unknown'); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
305 | - public function getClientMock( $method ) |
|
305 | + public function getClientMock($method) |
|
306 | 306 | { |
307 | - $object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Service\Standard::class ) |
|
308 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
309 | - ->setMethods( [$method] ) |
|
307 | + $object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Service\Standard::class) |
|
308 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
309 | + ->setMethods([$method]) |
|
310 | 310 | ->getMock(); |
311 | 311 | |
312 | - $object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
313 | - $object->setView( $this->getViewNoRender() ); |
|
312 | + $object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
313 | + $object->setView($this->getViewNoRender()); |
|
314 | 314 | |
315 | 315 | return $object; |
316 | 316 | } |
@@ -318,19 +318,19 @@ discard block |
||
318 | 318 | |
319 | 319 | protected function getViewNoRender() |
320 | 320 | { |
321 | - $view = $this->getMockBuilder( \Aimeos\MW\View\Standard::class ) |
|
322 | - ->setConstructorArgs( array( [] ) ) |
|
323 | - ->setMethods( array( 'render', 'config' ) ) |
|
321 | + $view = $this->getMockBuilder(\Aimeos\MW\View\Standard::class) |
|
322 | + ->setConstructorArgs(array([])) |
|
323 | + ->setMethods(array('render', 'config')) |
|
324 | 324 | ->getMock(); |
325 | 325 | |
326 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
326 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
327 | 327 | |
328 | - $param = ['site' => 'unittest', 'id' => $manager->findItem( 'unitpaymentcode' )->getId()]; |
|
329 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
|
330 | - $view->addHelper( 'param', $helper ); |
|
328 | + $param = ['site' => 'unittest', 'id' => $manager->findItem('unitpaymentcode')->getId()]; |
|
329 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param); |
|
330 | + $view->addHelper('param', $helper); |
|
331 | 331 | |
332 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] ); |
|
333 | - $view->addHelper( 'access', $helper ); |
|
332 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, []); |
|
333 | + $view->addHelper('access', $helper); |
|
334 | 334 | |
335 | 335 | return $view; |
336 | 336 | } |
@@ -21,70 +21,70 @@ discard block |
||
21 | 21 | $this->view = \TestHelperJqadm::getView(); |
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | |
24 | - $this->object = new \Aimeos\Admin\JQAdm\Service\Media\Standard( $this->context ); |
|
25 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
26 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
27 | - $this->object->setView( $this->view ); |
|
24 | + $this->object = new \Aimeos\Admin\JQAdm\Service\Media\Standard($this->context); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
26 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
27 | + $this->object->setView($this->view); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function tearDown() |
32 | 32 | { |
33 | - unset( $this->object, $this->view, $this->context ); |
|
33 | + unset($this->object, $this->view, $this->context); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testCreate() |
38 | 38 | { |
39 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
39 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
40 | 40 | |
41 | 41 | $this->view->item = $manager->createItem(); |
42 | 42 | $result = $this->object->create(); |
43 | 43 | |
44 | - $this->assertContains( 'item-media', $result ); |
|
45 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
44 | + $this->assertContains('item-media', $result); |
|
45 | + $this->assertNull($this->view->get('errors')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testCopy() |
50 | 50 | { |
51 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
51 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
52 | 52 | |
53 | - $this->view->item = $manager->findItem( 'unitcode', ['media'] ); |
|
53 | + $this->view->item = $manager->findItem('unitcode', ['media']); |
|
54 | 54 | $result = $this->object->copy(); |
55 | 55 | |
56 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
57 | - $this->assertContains( '"media.preview":"path\/to\/service.png"', $result ); |
|
56 | + $this->assertNull($this->view->get('errors')); |
|
57 | + $this->assertContains('"media.preview":"path\/to\/service.png"', $result); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | public function testDelete() |
62 | 62 | { |
63 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
63 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
64 | 64 | |
65 | 65 | $this->view->item = $manager->createItem(); |
66 | 66 | $result = $this->object->delete(); |
67 | 67 | |
68 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
69 | - $this->assertNull( $result ); |
|
68 | + $this->assertNull($this->view->get('errors')); |
|
69 | + $this->assertNull($result); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
73 | 73 | public function testGet() |
74 | 74 | { |
75 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
75 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
76 | 76 | |
77 | - $this->view->item = $manager->findItem( 'unitcode', ['media'] ); |
|
77 | + $this->view->item = $manager->findItem('unitcode', ['media']); |
|
78 | 78 | $result = $this->object->get(); |
79 | 79 | |
80 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
81 | - $this->assertContains( '"media.preview":"path\/to\/service.png"', $result ); |
|
80 | + $this->assertNull($this->view->get('errors')); |
|
81 | + $this->assertContains('"media.preview":"path\/to\/service.png"', $result); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | 85 | public function testSave() |
86 | 86 | { |
87 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
87 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
88 | 88 | $this->view->item = $manager->createItem(); |
89 | 89 | |
90 | 90 | |
@@ -99,108 +99,108 @@ discard block |
||
99 | 99 | ]], |
100 | 100 | ); |
101 | 101 | |
102 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
103 | - $this->view->addHelper( 'param', $helper ); |
|
102 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
103 | + $this->view->addHelper('param', $helper); |
|
104 | 104 | |
105 | - $file = $this->getMockBuilder( \Psr\Http\Message\UploadedFileInterface::class )->getMock(); |
|
106 | - $request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock(); |
|
107 | - $request->expects( $this->any() )->method( 'getUploadedFiles' ) |
|
108 | - ->will( $this->returnValue( ['media' => [0 => ['file' => $file] ] ] ) ); |
|
105 | + $file = $this->getMockBuilder(\Psr\Http\Message\UploadedFileInterface::class)->getMock(); |
|
106 | + $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock(); |
|
107 | + $request->expects($this->any())->method('getUploadedFiles') |
|
108 | + ->will($this->returnValue(['media' => [0 => ['file' => $file]]])); |
|
109 | 109 | |
110 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
111 | - $this->view ->addHelper( 'request', $helper ); |
|
110 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
111 | + $this->view ->addHelper('request', $helper); |
|
112 | 112 | |
113 | 113 | |
114 | 114 | $name = 'AdminJQAdmServiceMediaSave'; |
115 | - $this->context->getConfig()->set( 'controller/common/media/name', $name ); |
|
115 | + $this->context->getConfig()->set('controller/common/media/name', $name); |
|
116 | 116 | |
117 | - $cntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Media\\Standard' ) |
|
118 | - ->setConstructorArgs( array( $this->context ) ) |
|
119 | - ->setMethods( array( 'add' ) ) |
|
117 | + $cntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Media\\Standard') |
|
118 | + ->setConstructorArgs(array($this->context)) |
|
119 | + ->setMethods(array('add')) |
|
120 | 120 | ->getMock(); |
121 | 121 | |
122 | - \Aimeos\Controller\Common\Media\Factory::injectController( '\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub ); |
|
122 | + \Aimeos\Controller\Common\Media\Factory::injectController('\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub); |
|
123 | 123 | |
124 | - $cntlStub->expects( $this->once() )->method( 'add' ); |
|
124 | + $cntlStub->expects($this->once())->method('add'); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | $result = $this->object->save(); |
128 | 128 | |
129 | 129 | |
130 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
131 | - $this->assertNull( $result ); |
|
132 | - $this->assertEquals( 1, count( $this->view->item->getListItems() ) ); |
|
130 | + $this->assertNull($this->view->get('errors')); |
|
131 | + $this->assertNull($result); |
|
132 | + $this->assertEquals(1, count($this->view->item->getListItems())); |
|
133 | 133 | |
134 | - foreach( $this->view->item->getListItems( 'media' ) as $listItem ) |
|
134 | + foreach ($this->view->item->getListItems('media') as $listItem) |
|
135 | 135 | { |
136 | - $this->assertEquals( 'media', $listItem->getDomain() ); |
|
136 | + $this->assertEquals('media', $listItem->getDomain()); |
|
137 | 137 | |
138 | 138 | $refItem = $listItem->getRefItem(); |
139 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
140 | - $this->assertEquals( 'test', $refItem->getLabel() ); |
|
139 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
140 | + $this->assertEquals('test', $refItem->getLabel()); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
144 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, ['site' => 'unittest', 'media' => []] ); |
|
145 | - $this->view->addHelper( 'param', $helper ); |
|
144 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, ['site' => 'unittest', 'media' => []]); |
|
145 | + $this->view->addHelper('param', $helper); |
|
146 | 146 | |
147 | 147 | $result = $this->object->save(); |
148 | 148 | |
149 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
150 | - $this->assertNull( $result ); |
|
151 | - $this->assertEquals( 0, count( $this->view->item->getListItems() ) ); |
|
149 | + $this->assertNull($this->view->get('errors')); |
|
150 | + $this->assertNull($result); |
|
151 | + $this->assertEquals(0, count($this->view->item->getListItems())); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | 155 | public function testSaveException() |
156 | 156 | { |
157 | - $object = $this->getClientMock( 'fromArray' ); |
|
157 | + $object = $this->getClientMock('fromArray'); |
|
158 | 158 | |
159 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
160 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
159 | + $object->expects($this->once())->method('fromArray') |
|
160 | + ->will($this->throwException(new \RuntimeException())); |
|
161 | 161 | |
162 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
162 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
163 | 163 | $object->save(); |
164 | 164 | } |
165 | 165 | |
166 | 166 | |
167 | 167 | public function testSaveMShopException() |
168 | 168 | { |
169 | - $object = $this->getClientMock( 'fromArray' ); |
|
169 | + $object = $this->getClientMock('fromArray'); |
|
170 | 170 | |
171 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
172 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
171 | + $object->expects($this->once())->method('fromArray') |
|
172 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
173 | 173 | |
174 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
174 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
175 | 175 | $object->save(); |
176 | 176 | } |
177 | 177 | |
178 | 178 | |
179 | 179 | public function testSearch() |
180 | 180 | { |
181 | - $this->assertNull( $this->object->search() ); |
|
181 | + $this->assertNull($this->object->search()); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | 185 | public function testGetSubClient() |
186 | 186 | { |
187 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
188 | - $this->object->getSubClient( 'unknown' ); |
|
187 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
188 | + $this->object->getSubClient('unknown'); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
192 | - public function getClientMock( $method ) |
|
192 | + public function getClientMock($method) |
|
193 | 193 | { |
194 | - $object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Service\Media\Standard::class ) |
|
195 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
196 | - ->setMethods( [$method] ) |
|
194 | + $object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Service\Media\Standard::class) |
|
195 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
196 | + ->setMethods([$method]) |
|
197 | 197 | ->getMock(); |
198 | 198 | |
199 | 199 | $view = \TestHelperJqadm::getView(); |
200 | - $view->item = \Aimeos\MShop::create( $this->context, 'service' )->createItem(); |
|
200 | + $view->item = \Aimeos\MShop::create($this->context, 'service')->createItem(); |
|
201 | 201 | |
202 | - $object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
203 | - $object->setView( $view ); |
|
202 | + $object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
203 | + $object->setView($view); |
|
204 | 204 | |
205 | 205 | return $object; |
206 | 206 | } |
@@ -21,40 +21,40 @@ discard block |
||
21 | 21 | $this->view = \TestHelperJqadm::getView(); |
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | |
24 | - $this->object = new \Aimeos\Admin\JQAdm\Service\Media\Property\Standard( $this->context ); |
|
25 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
26 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
27 | - $this->object->setView( $this->view ); |
|
24 | + $this->object = new \Aimeos\Admin\JQAdm\Service\Media\Property\Standard($this->context); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
26 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
27 | + $this->object->setView($this->view); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function tearDown() |
32 | 32 | { |
33 | - unset( $this->object, $this->view, $this->context ); |
|
33 | + unset($this->object, $this->view, $this->context); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testCreate() |
38 | 38 | { |
39 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
39 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
40 | 40 | |
41 | 41 | $this->view->item = $manager->createItem(); |
42 | 42 | $result = $this->object->create(); |
43 | 43 | |
44 | - $this->assertContains( 'Media properties', $result ); |
|
45 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
44 | + $this->assertContains('Media properties', $result); |
|
45 | + $this->assertNull($this->view->get('errors')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testCopy() |
50 | 50 | { |
51 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
51 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
52 | 52 | |
53 | - $this->view->item = $manager->findItem( 'unitcode', ['media'] ); |
|
53 | + $this->view->item = $manager->findItem('unitcode', ['media']); |
|
54 | 54 | $result = $this->object->copy(); |
55 | 55 | |
56 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
57 | - $this->assertContains( 'item-media-property', $result ); |
|
56 | + $this->assertNull($this->view->get('errors')); |
|
57 | + $this->assertContains('item-media-property', $result); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -62,32 +62,32 @@ discard block |
||
62 | 62 | { |
63 | 63 | $result = $this->object->delete(); |
64 | 64 | |
65 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
66 | - $this->assertNull( $result ); |
|
65 | + $this->assertNull($this->view->get('errors')); |
|
66 | + $this->assertNull($result); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
70 | 70 | public function testGet() |
71 | 71 | { |
72 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
72 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
73 | 73 | |
74 | - $this->view->item = $manager->findItem( 'unitcode', ['media'] ); |
|
74 | + $this->view->item = $manager->findItem('unitcode', ['media']); |
|
75 | 75 | $result = $this->object->get(); |
76 | 76 | |
77 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
78 | - $this->assertContains( 'item-media-property', $result ); |
|
77 | + $this->assertNull($this->view->get('errors')); |
|
78 | + $this->assertContains('item-media-property', $result); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
82 | 82 | public function testSave() |
83 | 83 | { |
84 | - $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
|
84 | + $manager = \Aimeos\MShop::create($this->context, 'service'); |
|
85 | 85 | |
86 | - $item = $manager->findItem( 'unitcode', ['media'] ); |
|
87 | - $item->setCode( 'jqadm-test-media-property' ); |
|
88 | - $item->setId( null ); |
|
86 | + $item = $manager->findItem('unitcode', ['media']); |
|
87 | + $item->setCode('jqadm-test-media-property'); |
|
88 | + $item->setId(null); |
|
89 | 89 | |
90 | - $this->view->item = $manager->saveItem( $item ); |
|
90 | + $this->view->item = $manager->saveItem($item); |
|
91 | 91 | |
92 | 92 | $param = array( |
93 | 93 | 'site' => 'unittest', |
@@ -103,53 +103,53 @@ discard block |
||
103 | 103 | ), |
104 | 104 | ); |
105 | 105 | |
106 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
107 | - $this->view->addHelper( 'param', $helper ); |
|
106 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
107 | + $this->view->addHelper('param', $helper); |
|
108 | 108 | |
109 | 109 | |
110 | 110 | $result = $this->object->save(); |
111 | 111 | |
112 | 112 | |
113 | - $manager->deleteItem( $this->view->item->getId() ); |
|
113 | + $manager->deleteItem($this->view->item->getId()); |
|
114 | 114 | |
115 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
116 | - $this->assertNull( $result ); |
|
115 | + $this->assertNull($this->view->get('errors')); |
|
116 | + $this->assertNull($result); |
|
117 | 117 | |
118 | - $mediaItems = $this->view->item->getRefItems( 'media' ); |
|
119 | - $this->assertEquals( 1, count( $mediaItems ) ); |
|
120 | - $this->assertEquals( 1, count( reset( $mediaItems )->getPropertyItems() ) ); |
|
118 | + $mediaItems = $this->view->item->getRefItems('media'); |
|
119 | + $this->assertEquals(1, count($mediaItems)); |
|
120 | + $this->assertEquals(1, count(reset($mediaItems)->getPropertyItems())); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | |
124 | 124 | public function testSaveException() |
125 | 125 | { |
126 | - $object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Service\Media\Property\Standard::class ) |
|
127 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
128 | - ->setMethods( array( 'fromArray' ) ) |
|
126 | + $object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Service\Media\Property\Standard::class) |
|
127 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
128 | + ->setMethods(array('fromArray')) |
|
129 | 129 | ->getMock(); |
130 | 130 | |
131 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
132 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
131 | + $object->expects($this->once())->method('fromArray') |
|
132 | + ->will($this->throwException(new \RuntimeException())); |
|
133 | 133 | |
134 | 134 | $this->view = \TestHelperJqadm::getView(); |
135 | - $this->view->item = \Aimeos\MShop::create( $this->context, 'service' )->createItem(); |
|
135 | + $this->view->item = \Aimeos\MShop::create($this->context, 'service')->createItem(); |
|
136 | 136 | |
137 | - $object->setView( $this->view ); |
|
137 | + $object->setView($this->view); |
|
138 | 138 | |
139 | - $this->setExpectedException( \RuntimeException::class ); |
|
139 | + $this->setExpectedException(\RuntimeException::class); |
|
140 | 140 | $object->save(); |
141 | 141 | } |
142 | 142 | |
143 | 143 | |
144 | 144 | public function testSearch() |
145 | 145 | { |
146 | - $this->assertNull( $this->object->search() ); |
|
146 | + $this->assertNull($this->object->search()); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
150 | 150 | public function testGetSubClient() |
151 | 151 | { |
152 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
153 | - $this->object->getSubClient( 'unknown' ); |
|
152 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
153 | + $this->object->getSubClient('unknown'); |
|
154 | 154 | } |
155 | 155 | } |
@@ -17,42 +17,42 @@ |
||
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | 19 | $this->context = \TestHelperJqadm::getContext(); |
20 | - $this->context->setView( \TestHelperJqadm::getView() ); |
|
20 | + $this->context->setView(\TestHelperJqadm::getView()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | public function testCreateClient() |
25 | 25 | { |
26 | - $client = \Aimeos\Admin\JQAdm\Customer\Factory::create( $this->context ); |
|
27 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
26 | + $client = \Aimeos\Admin\JQAdm\Customer\Factory::create($this->context); |
|
27 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testCreateClientName() |
32 | 32 | { |
33 | - $client = \Aimeos\Admin\JQAdm\Customer\Factory::create( $this->context, 'Standard' ); |
|
34 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
33 | + $client = \Aimeos\Admin\JQAdm\Customer\Factory::create($this->context, 'Standard'); |
|
34 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testCreateClientNameEmpty() |
39 | 39 | { |
40 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
41 | - \Aimeos\Admin\JQAdm\Customer\Factory::create( $this->context, '' ); |
|
40 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
41 | + \Aimeos\Admin\JQAdm\Customer\Factory::create($this->context, ''); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testCreateClientNameInvalid() |
46 | 46 | { |
47 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
48 | - \Aimeos\Admin\JQAdm\Customer\Factory::create( $this->context, '%customer' ); |
|
47 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
48 | + \Aimeos\Admin\JQAdm\Customer\Factory::create($this->context, '%customer'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | public function testCreateClientNameNotFound() |
53 | 53 | { |
54 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
55 | - \Aimeos\Admin\JQAdm\Customer\Factory::create( $this->context, 'test' ); |
|
54 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
55 | + \Aimeos\Admin\JQAdm\Customer\Factory::create($this->context, 'test'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | } |
@@ -17,42 +17,42 @@ |
||
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | 19 | $this->context = \TestHelperJqadm::getContext(); |
20 | - $this->context->setView( \TestHelperJqadm::getView() ); |
|
20 | + $this->context->setView(\TestHelperJqadm::getView()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | public function testCreateClient() |
25 | 25 | { |
26 | - $client = \Aimeos\Admin\JQAdm\Supplier\Factory::create( $this->context ); |
|
27 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
26 | + $client = \Aimeos\Admin\JQAdm\Supplier\Factory::create($this->context); |
|
27 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testCreateClientName() |
32 | 32 | { |
33 | - $client = \Aimeos\Admin\JQAdm\Supplier\Factory::create( $this->context, 'Standard' ); |
|
34 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
33 | + $client = \Aimeos\Admin\JQAdm\Supplier\Factory::create($this->context, 'Standard'); |
|
34 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testCreateClientNameEmpty() |
39 | 39 | { |
40 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
41 | - \Aimeos\Admin\JQAdm\Supplier\Factory::create( $this->context, '' ); |
|
40 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
41 | + \Aimeos\Admin\JQAdm\Supplier\Factory::create($this->context, ''); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testCreateClientNameInvalid() |
46 | 46 | { |
47 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
48 | - \Aimeos\Admin\JQAdm\Supplier\Factory::create( $this->context, '%supplier' ); |
|
47 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
48 | + \Aimeos\Admin\JQAdm\Supplier\Factory::create($this->context, '%supplier'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | public function testCreateClientNameNotFound() |
53 | 53 | { |
54 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
55 | - \Aimeos\Admin\JQAdm\Supplier\Factory::create( $this->context, 'test' ); |
|
54 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
55 | + \Aimeos\Admin\JQAdm\Supplier\Factory::create($this->context, 'test'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | } |
@@ -21,70 +21,70 @@ discard block |
||
21 | 21 | $this->view = \TestHelperJqadm::getView(); |
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | |
24 | - $this->object = new \Aimeos\Admin\JQAdm\Supplier\Media\Standard( $this->context ); |
|
25 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context ); |
|
26 | - $this->object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
27 | - $this->object->setView( $this->view ); |
|
24 | + $this->object = new \Aimeos\Admin\JQAdm\Supplier\Media\Standard($this->context); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($this->object, $this->context); |
|
26 | + $this->object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
27 | + $this->object->setView($this->view); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function tearDown() |
32 | 32 | { |
33 | - unset( $this->object, $this->view, $this->context ); |
|
33 | + unset($this->object, $this->view, $this->context); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testCreate() |
38 | 38 | { |
39 | - $manager = \Aimeos\MShop::create( $this->context, 'supplier' ); |
|
39 | + $manager = \Aimeos\MShop::create($this->context, 'supplier'); |
|
40 | 40 | |
41 | 41 | $this->view->item = $manager->createItem(); |
42 | 42 | $result = $this->object->create(); |
43 | 43 | |
44 | - $this->assertContains( 'item-media', $result ); |
|
45 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
44 | + $this->assertContains('item-media', $result); |
|
45 | + $this->assertNull($this->view->get('errors')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testCopy() |
50 | 50 | { |
51 | - $manager = \Aimeos\MShop::create( $this->context, 'supplier' ); |
|
51 | + $manager = \Aimeos\MShop::create($this->context, 'supplier'); |
|
52 | 52 | |
53 | - $this->view->item = $manager->findItem( 'unitCode001', ['media'] ); |
|
53 | + $this->view->item = $manager->findItem('unitCode001', ['media']); |
|
54 | 54 | $result = $this->object->copy(); |
55 | 55 | |
56 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
57 | - $this->assertContains( '"media.preview":"path\/to\/supplier.jpg"', $result ); |
|
56 | + $this->assertNull($this->view->get('errors')); |
|
57 | + $this->assertContains('"media.preview":"path\/to\/supplier.jpg"', $result); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | public function testDelete() |
62 | 62 | { |
63 | - $manager = \Aimeos\MShop::create( $this->context, 'supplier' ); |
|
63 | + $manager = \Aimeos\MShop::create($this->context, 'supplier'); |
|
64 | 64 | |
65 | 65 | $this->view->item = $manager->createItem(); |
66 | 66 | $result = $this->object->delete(); |
67 | 67 | |
68 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
69 | - $this->assertNull( $result ); |
|
68 | + $this->assertNull($this->view->get('errors')); |
|
69 | + $this->assertNull($result); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
73 | 73 | public function testGet() |
74 | 74 | { |
75 | - $manager = \Aimeos\MShop::create( $this->context, 'supplier' ); |
|
75 | + $manager = \Aimeos\MShop::create($this->context, 'supplier'); |
|
76 | 76 | |
77 | - $this->view->item = $manager->findItem( 'unitCode001', ['media'] ); |
|
77 | + $this->view->item = $manager->findItem('unitCode001', ['media']); |
|
78 | 78 | $result = $this->object->get(); |
79 | 79 | |
80 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
81 | - $this->assertContains( '"media.preview":"path\/to\/supplier.jpg"', $result ); |
|
80 | + $this->assertNull($this->view->get('errors')); |
|
81 | + $this->assertContains('"media.preview":"path\/to\/supplier.jpg"', $result); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | 85 | public function testSave() |
86 | 86 | { |
87 | - $manager = \Aimeos\MShop::create( $this->context, 'supplier' ); |
|
87 | + $manager = \Aimeos\MShop::create($this->context, 'supplier'); |
|
88 | 88 | $this->view->item = $manager->createItem(); |
89 | 89 | |
90 | 90 | $param = array( |
@@ -98,108 +98,108 @@ discard block |
||
98 | 98 | ]], |
99 | 99 | ); |
100 | 100 | |
101 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
102 | - $this->view->addHelper( 'param', $helper ); |
|
101 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
102 | + $this->view->addHelper('param', $helper); |
|
103 | 103 | |
104 | - $file = $this->getMockBuilder( \Psr\Http\Message\UploadedFileInterface::class )->getMock(); |
|
105 | - $request = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock(); |
|
106 | - $request->expects( $this->any() )->method( 'getUploadedFiles' ) |
|
107 | - ->will( $this->returnValue( ['media' => [0 => ['file' => $file] ] ] ) ); |
|
104 | + $file = $this->getMockBuilder(\Psr\Http\Message\UploadedFileInterface::class)->getMock(); |
|
105 | + $request = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock(); |
|
106 | + $request->expects($this->any())->method('getUploadedFiles') |
|
107 | + ->will($this->returnValue(['media' => [0 => ['file' => $file]]])); |
|
108 | 108 | |
109 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
110 | - $this->view ->addHelper( 'request', $helper ); |
|
109 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
110 | + $this->view ->addHelper('request', $helper); |
|
111 | 111 | |
112 | 112 | |
113 | 113 | $name = 'AdminJQAdmSupplierMediaSave'; |
114 | - $this->context->getConfig()->set( 'controller/common/media/name', $name ); |
|
114 | + $this->context->getConfig()->set('controller/common/media/name', $name); |
|
115 | 115 | |
116 | - $cntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Media\\Standard' ) |
|
117 | - ->setConstructorArgs( array( $this->context ) ) |
|
118 | - ->setMethods( array( 'add' ) ) |
|
116 | + $cntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Media\\Standard') |
|
117 | + ->setConstructorArgs(array($this->context)) |
|
118 | + ->setMethods(array('add')) |
|
119 | 119 | ->getMock(); |
120 | 120 | |
121 | - \Aimeos\Controller\Common\Media\Factory::injectController( '\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub ); |
|
121 | + \Aimeos\Controller\Common\Media\Factory::injectController('\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub); |
|
122 | 122 | |
123 | - $cntlStub->expects( $this->once() )->method( 'add' ); |
|
123 | + $cntlStub->expects($this->once())->method('add'); |
|
124 | 124 | |
125 | 125 | |
126 | 126 | $result = $this->object->save(); |
127 | 127 | |
128 | 128 | |
129 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
130 | - $this->assertNull( $result ); |
|
131 | - $this->assertEquals( 1, count( $this->view->item->getListItems() ) ); |
|
129 | + $this->assertNull($this->view->get('errors')); |
|
130 | + $this->assertNull($result); |
|
131 | + $this->assertEquals(1, count($this->view->item->getListItems())); |
|
132 | 132 | |
133 | - foreach( $this->view->item->getListItems( 'media' ) as $listItem ) |
|
133 | + foreach ($this->view->item->getListItems('media') as $listItem) |
|
134 | 134 | { |
135 | - $this->assertEquals( 'media', $listItem->getDomain() ); |
|
135 | + $this->assertEquals('media', $listItem->getDomain()); |
|
136 | 136 | |
137 | 137 | $refItem = $listItem->getRefItem(); |
138 | - $this->assertEquals( 'de', $refItem->getLanguageId() ); |
|
139 | - $this->assertEquals( 'test', $refItem->getLabel() ); |
|
138 | + $this->assertEquals('de', $refItem->getLanguageId()); |
|
139 | + $this->assertEquals('test', $refItem->getLabel()); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, ['site' => 'unittest', 'media' => []] ); |
|
144 | - $this->view->addHelper( 'param', $helper ); |
|
143 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, ['site' => 'unittest', 'media' => []]); |
|
144 | + $this->view->addHelper('param', $helper); |
|
145 | 145 | |
146 | 146 | $result = $this->object->save(); |
147 | 147 | |
148 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
149 | - $this->assertNull( $result ); |
|
150 | - $this->assertEquals( 0, count( $this->view->item->getListItems() ) ); |
|
148 | + $this->assertNull($this->view->get('errors')); |
|
149 | + $this->assertNull($result); |
|
150 | + $this->assertEquals(0, count($this->view->item->getListItems())); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | public function testSaveException() |
155 | 155 | { |
156 | - $object = $this->getClientMock( 'fromArray' ); |
|
156 | + $object = $this->getClientMock('fromArray'); |
|
157 | 157 | |
158 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
159 | - ->will( $this->throwException( new \RuntimeException() ) ); |
|
158 | + $object->expects($this->once())->method('fromArray') |
|
159 | + ->will($this->throwException(new \RuntimeException())); |
|
160 | 160 | |
161 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
161 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
162 | 162 | $object->save(); |
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | public function testSaveMShopException() |
167 | 167 | { |
168 | - $object = $this->getClientMock( 'fromArray' ); |
|
168 | + $object = $this->getClientMock('fromArray'); |
|
169 | 169 | |
170 | - $object->expects( $this->once() )->method( 'fromArray' ) |
|
171 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
170 | + $object->expects($this->once())->method('fromArray') |
|
171 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
172 | 172 | |
173 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
173 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
174 | 174 | $object->save(); |
175 | 175 | } |
176 | 176 | |
177 | 177 | |
178 | 178 | public function testSearch() |
179 | 179 | { |
180 | - $this->assertNull( $this->object->search() ); |
|
180 | + $this->assertNull($this->object->search()); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | 184 | public function testGetSubClient() |
185 | 185 | { |
186 | - $this->setExpectedException( \Aimeos\Admin\JQAdm\Exception::class ); |
|
187 | - $this->object->getSubClient( 'unknown' ); |
|
186 | + $this->setExpectedException(\Aimeos\Admin\JQAdm\Exception::class); |
|
187 | + $this->object->getSubClient('unknown'); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
191 | - public function getClientMock( $method ) |
|
191 | + public function getClientMock($method) |
|
192 | 192 | { |
193 | - $object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Supplier\Media\Standard::class ) |
|
194 | - ->setConstructorArgs( array( $this->context, \TestHelperJqadm::getTemplatePaths() ) ) |
|
195 | - ->setMethods( [$method] ) |
|
193 | + $object = $this->getMockBuilder(\Aimeos\Admin\JQAdm\Supplier\Media\Standard::class) |
|
194 | + ->setConstructorArgs(array($this->context, \TestHelperJqadm::getTemplatePaths())) |
|
195 | + ->setMethods([$method]) |
|
196 | 196 | ->getMock(); |
197 | 197 | |
198 | 198 | $view = \TestHelperJqadm::getView(); |
199 | - $view->item = \Aimeos\MShop::create( $this->context, 'supplier' )->createItem(); |
|
199 | + $view->item = \Aimeos\MShop::create($this->context, 'supplier')->createItem(); |
|
200 | 200 | |
201 | - $object->setAimeos( \TestHelperJqadm::getAimeos() ); |
|
202 | - $object->setView( $view ); |
|
201 | + $object->setAimeos(\TestHelperJqadm::getAimeos()); |
|
202 | + $object->setView($view); |
|
203 | 203 | |
204 | 204 | return $object; |
205 | 205 | } |