@@ -22,68 +22,68 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Physical\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Physical\Standard($this->context, $templatePaths); |
|
26 | + $this->object->setView($this->view); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - unset( $this->object ); |
|
32 | + unset($this->object); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testCreate() |
37 | 37 | { |
38 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
38 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
39 | 39 | |
40 | 40 | $this->view->item = $manager->createItem(); |
41 | 41 | $result = $this->object->create(); |
42 | 42 | |
43 | - $this->assertContains( 'Physical', $result ); |
|
44 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
43 | + $this->assertContains('Physical', $result); |
|
44 | + $this->assertNull($this->view->get('errors')); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | public function testCopy() |
49 | 49 | { |
50 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
50 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
51 | 51 | |
52 | - $this->view->item = $manager->findItem( 'CNC' ); |
|
52 | + $this->view->item = $manager->findItem('CNC'); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'value="20.0"', $result ); |
|
57 | - $this->assertContains( 'value="15.0"', $result ); |
|
58 | - $this->assertContains( 'value="10.0"', $result ); |
|
59 | - $this->assertContains( 'value="1.25"', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('value="20.0"', $result); |
|
57 | + $this->assertContains('value="15.0"', $result); |
|
58 | + $this->assertContains('value="10.0"', $result); |
|
59 | + $this->assertContains('value="1.25"', $result); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | public function testGet() |
64 | 64 | { |
65 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
65 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
66 | 66 | |
67 | - $this->view->item = $manager->findItem( 'CNC' ); |
|
67 | + $this->view->item = $manager->findItem('CNC'); |
|
68 | 68 | $result = $this->object->get(); |
69 | 69 | |
70 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
71 | - $this->assertContains( 'value="20.0"', $result ); |
|
72 | - $this->assertContains( 'value="15.0"', $result ); |
|
73 | - $this->assertContains( 'value="10.0"', $result ); |
|
74 | - $this->assertContains( 'value="1.25"', $result ); |
|
70 | + $this->assertNull($this->view->get('errors')); |
|
71 | + $this->assertContains('value="20.0"', $result); |
|
72 | + $this->assertContains('value="15.0"', $result); |
|
73 | + $this->assertContains('value="10.0"', $result); |
|
74 | + $this->assertContains('value="1.25"', $result); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testSave() |
79 | 79 | { |
80 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
80 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
81 | 81 | |
82 | - $item = $manager->findItem( 'CNC' ); |
|
83 | - $item->setCode( 'jqadm-test-physical' ); |
|
84 | - $item->setId( null ); |
|
82 | + $item = $manager->findItem('CNC'); |
|
83 | + $item->setCode('jqadm-test-physical'); |
|
84 | + $item->setId(null); |
|
85 | 85 | |
86 | - $manager->saveItem( $item ); |
|
86 | + $manager->saveItem($item); |
|
87 | 87 | |
88 | 88 | |
89 | 89 | $param = array( |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | ), |
94 | 94 | ); |
95 | 95 | |
96 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
97 | - $this->view->addHelper( 'param', $helper ); |
|
96 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
97 | + $this->view->addHelper('param', $helper); |
|
98 | 98 | $this->view->item = $item; |
99 | 99 | |
100 | 100 | $result = $this->object->save(); |
101 | 101 | |
102 | - $manager->deleteItem( $item->getId() ); |
|
102 | + $manager->deleteItem($item->getId()); |
|
103 | 103 | |
104 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
105 | - $this->assertNull( $result ); |
|
104 | + $this->assertNull($this->view->get('errors')); |
|
105 | + $this->assertNull($result); |
|
106 | 106 | } |
107 | 107 | } |
@@ -22,39 +22,39 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Image\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Image\Standard($this->context, $templatePaths); |
|
26 | + $this->object->setView($this->view); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - unset( $this->object ); |
|
32 | + unset($this->object); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testCreate() |
37 | 37 | { |
38 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
38 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
39 | 39 | |
40 | 40 | $this->view->item = $manager->createItem(); |
41 | 41 | $result = $this->object->create(); |
42 | 42 | |
43 | - $this->assertContains( 'Images', $result ); |
|
44 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
43 | + $this->assertContains('Images', $result); |
|
44 | + $this->assertNull($this->view->get('errors')); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | public function testCopy() |
49 | 49 | { |
50 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
50 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
51 | 51 | |
52 | - $this->view->item = $manager->findItem( 'CNC', array( 'media' ) ); |
|
52 | + $this->view->item = $manager->findItem('CNC', array('media')); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'src="/prod_123x103/195_prod_123x103.jpg"', $result ); |
|
57 | - $this->assertContains( 'src="/prod_266x221/198_prod_266x221.jpg"', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('src="/prod_123x103/195_prod_123x103.jpg"', $result); |
|
57 | + $this->assertContains('src="/prod_266x221/198_prod_266x221.jpg"', $result); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -62,97 +62,97 @@ 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\Factory::createManager( $this->context, 'product' ); |
|
72 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
73 | 73 | |
74 | - $this->view->item = $manager->findItem( 'CNC', array( 'media' ) ); |
|
74 | + $this->view->item = $manager->findItem('CNC', array('media')); |
|
75 | 75 | $result = $this->object->get(); |
76 | 76 | |
77 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
78 | - $this->assertContains( 'src="/prod_123x103/195_prod_123x103.jpg"', $result ); |
|
79 | - $this->assertContains( 'src="/prod_266x221/198_prod_266x221.jpg"', $result ); |
|
77 | + $this->assertNull($this->view->get('errors')); |
|
78 | + $this->assertContains('src="/prod_123x103/195_prod_123x103.jpg"', $result); |
|
79 | + $this->assertContains('src="/prod_266x221/198_prod_266x221.jpg"', $result); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | 83 | public function testSave() |
84 | 84 | { |
85 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
85 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
86 | 86 | |
87 | - $item = $manager->findItem( 'CNC' ); |
|
88 | - $item->setCode( 'jqadm-test-image' ); |
|
89 | - $item->setId( null ); |
|
87 | + $item = $manager->findItem('CNC'); |
|
88 | + $item->setCode('jqadm-test-image'); |
|
89 | + $item->setId(null); |
|
90 | 90 | |
91 | - $manager->saveItem( $item ); |
|
91 | + $manager->saveItem($item); |
|
92 | 92 | |
93 | 93 | |
94 | 94 | $param = array( |
95 | 95 | 'image' => array( |
96 | - 'product.lists.id' => array( '' ), |
|
97 | - 'media.languageid' => array( 'de' ), |
|
98 | - 'media.label' => array( 'test' ), |
|
96 | + 'product.lists.id' => array(''), |
|
97 | + 'media.languageid' => array('de'), |
|
98 | + 'media.label' => array('test'), |
|
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->getMock( '\Psr\Http\Message\UploadedFileInterface' ); |
|
106 | - $request = $this->getMock( '\Psr\Http\Message\ServerRequestInterface' ); |
|
107 | - $request->expects( $this->any() )->method( 'getUploadedFiles' ) |
|
108 | - ->will( $this->returnValue( array( 'image' => array( 'files' => array( $file ) ) ) ) ); |
|
105 | + $file = $this->getMock('\Psr\Http\Message\UploadedFileInterface'); |
|
106 | + $request = $this->getMock('\Psr\Http\Message\ServerRequestInterface'); |
|
107 | + $request->expects($this->any())->method('getUploadedFiles') |
|
108 | + ->will($this->returnValue(array('image' => array('files' => array($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 | $this->view->item = $item; |
114 | 114 | |
115 | 115 | |
116 | 116 | $name = 'AdminJQAdmProductImageSave'; |
117 | - $this->context->getConfig()->set( 'controller/common/media/name', $name ); |
|
117 | + $this->context->getConfig()->set('controller/common/media/name', $name); |
|
118 | 118 | |
119 | - $cntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Media\\Standard' ) |
|
120 | - ->setConstructorArgs( array( $this->context ) ) |
|
121 | - ->setMethods( array( 'add' ) ) |
|
119 | + $cntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Media\\Standard') |
|
120 | + ->setConstructorArgs(array($this->context)) |
|
121 | + ->setMethods(array('add')) |
|
122 | 122 | ->getMock(); |
123 | 123 | |
124 | - \Aimeos\Controller\Common\Media\Factory::injectController( '\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub ); |
|
124 | + \Aimeos\Controller\Common\Media\Factory::injectController('\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub); |
|
125 | 125 | |
126 | - $cntlStub->expects( $this->once() )->method( 'add' ); |
|
126 | + $cntlStub->expects($this->once())->method('add'); |
|
127 | 127 | |
128 | 128 | |
129 | - $mediaStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Media\\Manager\\Standard' ) |
|
130 | - ->setConstructorArgs( array( $this->context ) ) |
|
131 | - ->setMethods( array( 'saveItem' ) ) |
|
129 | + $mediaStub = $this->getMockBuilder('\\Aimeos\\MShop\\Media\\Manager\\Standard') |
|
130 | + ->setConstructorArgs(array($this->context)) |
|
131 | + ->setMethods(array('saveItem')) |
|
132 | 132 | ->getMock(); |
133 | 133 | |
134 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'media', $mediaStub ); |
|
134 | + \Aimeos\MShop\Factory::injectManager($this->context, 'media', $mediaStub); |
|
135 | 135 | |
136 | - $mediaStub->expects( $this->once() )->method( 'saveItem' ); |
|
136 | + $mediaStub->expects($this->once())->method('saveItem'); |
|
137 | 137 | |
138 | 138 | |
139 | - \Aimeos\MShop\Factory::setCache( true ); |
|
139 | + \Aimeos\MShop\Factory::setCache(true); |
|
140 | 140 | |
141 | 141 | $result = $this->object->save(); |
142 | 142 | |
143 | - \Aimeos\MShop\Factory::setCache( false ); |
|
143 | + \Aimeos\MShop\Factory::setCache(false); |
|
144 | 144 | |
145 | - $item = $manager->getItem( $item->getId(), array( 'media' ) ); |
|
146 | - $manager->deleteItem( $item->getId() ); |
|
145 | + $item = $manager->getItem($item->getId(), array('media')); |
|
146 | + $manager->deleteItem($item->getId()); |
|
147 | 147 | |
148 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
149 | - $this->assertNull( $result ); |
|
150 | - $this->assertEquals( 1, count( $item->getListItems( 'media' ) ) ); |
|
148 | + $this->assertNull($this->view->get('errors')); |
|
149 | + $this->assertNull($result); |
|
150 | + $this->assertEquals(1, count($item->getListItems('media'))); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | public function testSearch() |
155 | 155 | { |
156 | - $this->assertNull( $this->object->search() ); |
|
156 | + $this->assertNull($this->object->search()); |
|
157 | 157 | } |
158 | 158 | } |
@@ -22,40 +22,40 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Category\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Category\Standard($this->context, $templatePaths); |
|
26 | + $this->object->setView($this->view); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | protected function tearDown() |
31 | 31 | { |
32 | - unset( $this->object ); |
|
32 | + unset($this->object); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testCreate() |
37 | 37 | { |
38 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
38 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
39 | 39 | |
40 | 40 | $this->view->item = $manager->createItem(); |
41 | 41 | $result = $this->object->create(); |
42 | 42 | |
43 | - $this->assertContains( 'Categories', $result ); |
|
44 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
43 | + $this->assertContains('Categories', $result); |
|
44 | + $this->assertNull($this->view->get('errors')); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | public function testCopy() |
49 | 49 | { |
50 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
50 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
51 | 51 | |
52 | - $this->view->item = $manager->findItem( 'CNC' ); |
|
52 | + $this->view->item = $manager->findItem('CNC'); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'value="Internet"', $result ); |
|
57 | - $this->assertContains( 'value="Neu"', $result ); |
|
58 | - $this->assertContains( 'value="Kaffee"', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('value="Internet"', $result); |
|
57 | + $this->assertContains('value="Neu"', $result); |
|
58 | + $this->assertContains('value="Kaffee"', $result); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -63,105 +63,105 @@ discard block |
||
63 | 63 | { |
64 | 64 | $result = $this->object->delete(); |
65 | 65 | |
66 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
67 | - $this->assertNull( $result ); |
|
66 | + $this->assertNull($this->view->get('errors')); |
|
67 | + $this->assertNull($result); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
71 | 71 | public function testGet() |
72 | 72 | { |
73 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
73 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
74 | 74 | |
75 | - $this->view->item = $manager->findItem( 'CNC' ); |
|
75 | + $this->view->item = $manager->findItem('CNC'); |
|
76 | 76 | $result = $this->object->get(); |
77 | 77 | |
78 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
79 | - $this->assertContains( 'value="Internet"', $result ); |
|
80 | - $this->assertContains( 'value="Neu"', $result ); |
|
81 | - $this->assertContains( 'value="Kaffee"', $result ); |
|
78 | + $this->assertNull($this->view->get('errors')); |
|
79 | + $this->assertContains('value="Internet"', $result); |
|
80 | + $this->assertContains('value="Neu"', $result); |
|
81 | + $this->assertContains('value="Kaffee"', $result); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | 85 | public function testSave() |
86 | 86 | { |
87 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' ); |
|
88 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog/lists/type' ); |
|
89 | - $productManager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
87 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'catalog'); |
|
88 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->context, 'catalog/lists/type'); |
|
89 | + $productManager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
90 | 90 | |
91 | - $item = $manager->findItem( 'root' ); |
|
92 | - $item->setCode( 'jqadm-test-root' ); |
|
93 | - $item->setId( null ); |
|
91 | + $item = $manager->findItem('root'); |
|
92 | + $item->setCode('jqadm-test-root'); |
|
93 | + $item->setId(null); |
|
94 | 94 | |
95 | - $manager->insertItem( $item ); |
|
95 | + $manager->insertItem($item); |
|
96 | 96 | |
97 | 97 | |
98 | - $typeid = $typeManager->findItem( 'default', array(), 'product' )->getId(); |
|
98 | + $typeid = $typeManager->findItem('default', array(), 'product')->getId(); |
|
99 | 99 | |
100 | 100 | $param = array( |
101 | 101 | 'category' => array( |
102 | - 'catalog.lists.id' => array( '' ), |
|
103 | - 'catalog.lists.typeid' => array( $typeid ), |
|
104 | - 'catalog.id' => array( $item->getId() ), |
|
102 | + 'catalog.lists.id' => array(''), |
|
103 | + 'catalog.lists.typeid' => array($typeid), |
|
104 | + 'catalog.id' => array($item->getId()), |
|
105 | 105 | ), |
106 | 106 | ); |
107 | 107 | |
108 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
109 | - $this->view->addHelper( 'param', $helper ); |
|
108 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
109 | + $this->view->addHelper('param', $helper); |
|
110 | 110 | $this->view->item = $productManager->createItem(); |
111 | 111 | |
112 | 112 | $result = $this->object->save(); |
113 | 113 | |
114 | - $item = $manager->getItem( $item->getId(), array( 'product' ) ); |
|
115 | - $manager->deleteItem( $item->getId() ); |
|
114 | + $item = $manager->getItem($item->getId(), array('product')); |
|
115 | + $manager->deleteItem($item->getId()); |
|
116 | 116 | |
117 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
118 | - $this->assertNull( $result ); |
|
119 | - $this->assertEquals( 1, count( $item->getListItems( 'product' ) ) ); |
|
117 | + $this->assertNull($this->view->get('errors')); |
|
118 | + $this->assertNull($result); |
|
119 | + $this->assertEquals(1, count($item->getListItems('product'))); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
123 | 123 | public function testSavePromotion() |
124 | 124 | { |
125 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' ); |
|
126 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog/lists/type' ); |
|
127 | - $productManager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
125 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'catalog'); |
|
126 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->context, 'catalog/lists/type'); |
|
127 | + $productManager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
128 | 128 | |
129 | - $item = $manager->findItem( 'root' ); |
|
130 | - $item->setCode( 'jqadm-test-root' ); |
|
131 | - $item->setId( null ); |
|
129 | + $item = $manager->findItem('root'); |
|
130 | + $item->setCode('jqadm-test-root'); |
|
131 | + $item->setId(null); |
|
132 | 132 | |
133 | - $manager->insertItem( $item ); |
|
133 | + $manager->insertItem($item); |
|
134 | 134 | |
135 | 135 | |
136 | - $typeid = $typeManager->findItem( 'promotion', array(), 'product' )->getId(); |
|
136 | + $typeid = $typeManager->findItem('promotion', array(), 'product')->getId(); |
|
137 | 137 | |
138 | 138 | $param = array( |
139 | 139 | 'category' => array( |
140 | - 'catalog.lists.id' => array( '' ), |
|
141 | - 'catalog.lists.typeid' => array( $typeid ), |
|
142 | - 'catalog.id' => array( $item->getId() ), |
|
140 | + 'catalog.lists.id' => array(''), |
|
141 | + 'catalog.lists.typeid' => array($typeid), |
|
142 | + 'catalog.id' => array($item->getId()), |
|
143 | 143 | ), |
144 | 144 | ); |
145 | 145 | |
146 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
147 | - $this->view->addHelper( 'param', $helper ); |
|
146 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
147 | + $this->view->addHelper('param', $helper); |
|
148 | 148 | $this->view->item = $productManager->createItem(); |
149 | 149 | |
150 | 150 | $result = $this->object->save(); |
151 | 151 | |
152 | - $item = $manager->getItem( $item->getId(), array( 'product' ) ); |
|
153 | - $listItems = $item->getListItems( 'product' ); |
|
154 | - $manager->deleteItem( $item->getId() ); |
|
152 | + $item = $manager->getItem($item->getId(), array('product')); |
|
153 | + $listItems = $item->getListItems('product'); |
|
154 | + $manager->deleteItem($item->getId()); |
|
155 | 155 | |
156 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
157 | - $this->assertNull( $result ); |
|
158 | - $this->assertEquals( 1, count( $listItems ) ); |
|
159 | - $this->assertEquals( $typeid, reset( $listItems )->getTypeId() ); |
|
156 | + $this->assertNull($this->view->get('errors')); |
|
157 | + $this->assertNull($result); |
|
158 | + $this->assertEquals(1, count($listItems)); |
|
159 | + $this->assertEquals($typeid, reset($listItems)->getTypeId()); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
163 | 163 | public function testSearch() |
164 | 164 | { |
165 | - $this->assertNull( $this->object->search() ); |
|
165 | + $this->assertNull($this->object->search()); |
|
166 | 166 | } |
167 | 167 | } |
@@ -19,45 +19,45 @@ |
||
19 | 19 | |
20 | 20 | protected function setUp() |
21 | 21 | { |
22 | - $this->cache = $this->getMockBuilder( 'Aimeos\MW\Cache\None' ) |
|
23 | - ->setMethods( array( 'deleteByTags' ) ) |
|
22 | + $this->cache = $this->getMockBuilder('Aimeos\MW\Cache\None') |
|
23 | + ->setMethods(array('deleteByTags')) |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->mock = $this->getMockBuilder( 'Aimeos\Admin\JQAdm\Product\Category\Standard' ) |
|
28 | - ->setMethods( array( 'save' ) ) |
|
27 | + $this->mock = $this->getMockBuilder('Aimeos\Admin\JQAdm\Product\Category\Standard') |
|
28 | + ->setMethods(array('save')) |
|
29 | 29 | ->disableOriginalConstructor() |
30 | 30 | ->getMock(); |
31 | 31 | |
32 | 32 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
33 | 33 | $this->context = \TestHelperJqadm::getContext(); |
34 | - $this->context->setCache( $this->cache ); |
|
34 | + $this->context->setCache($this->cache); |
|
35 | 35 | |
36 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Category\Decorator\Cache( $this->mock, $this->context, $templatePaths ); |
|
36 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Category\Decorator\Cache($this->mock, $this->context, $templatePaths); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | 40 | protected function tearDown() |
41 | 41 | { |
42 | - unset( $this->object, $this->mock, $this->context, $this->cache ); |
|
42 | + unset($this->object, $this->mock, $this->context, $this->cache); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | public function testSave() |
47 | 47 | { |
48 | 48 | $view = \TestHelperJqadm::getView(); |
49 | - $tags = array( 'catalog', 'catalog-1', 'catalog-2' ); |
|
49 | + $tags = array('catalog', 'catalog-1', 'catalog-2'); |
|
50 | 50 | |
51 | - $param = array( 'category' => array( 'catalog.id' => array( '1', '2' ) ) ); |
|
52 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
|
53 | - $view->addHelper( 'param', $helper ); |
|
51 | + $param = array('category' => array('catalog.id' => array('1', '2'))); |
|
52 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param); |
|
53 | + $view->addHelper('param', $helper); |
|
54 | 54 | |
55 | - $this->cache->expects( $this->once() )->method( 'deleteByTags' )->with( $this->equalTo( $tags ) ); |
|
56 | - $this->mock->expects( $this->once() )->method( 'save' )->will( $this->returnValue( 'test' ) ); |
|
55 | + $this->cache->expects($this->once())->method('deleteByTags')->with($this->equalTo($tags)); |
|
56 | + $this->mock->expects($this->once())->method('save')->will($this->returnValue('test')); |
|
57 | 57 | |
58 | - $this->object->setView( $view ); |
|
58 | + $this->object->setView($view); |
|
59 | 59 | $result = $this->object->save(); |
60 | 60 | |
61 | - $this->assertEquals( 'test', $result ); |
|
61 | + $this->assertEquals('test', $result); |
|
62 | 62 | } |
63 | 63 | } |
@@ -19,44 +19,44 @@ |
||
19 | 19 | |
20 | 20 | protected function setUp() |
21 | 21 | { |
22 | - $this->cache = $this->getMockBuilder( 'Aimeos\MW\Cache\None' ) |
|
23 | - ->setMethods( array( 'deleteByTags' ) ) |
|
22 | + $this->cache = $this->getMockBuilder('Aimeos\MW\Cache\None') |
|
23 | + ->setMethods(array('deleteByTags')) |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->mock = $this->getMockBuilder( 'Aimeos\Admin\JQAdm\Product\Standard' ) |
|
28 | - ->setMethods( array( 'save' ) ) |
|
27 | + $this->mock = $this->getMockBuilder('Aimeos\Admin\JQAdm\Product\Standard') |
|
28 | + ->setMethods(array('save')) |
|
29 | 29 | ->disableOriginalConstructor() |
30 | 30 | ->getMock(); |
31 | 31 | |
32 | 32 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
33 | 33 | $this->context = \TestHelperJqadm::getContext(); |
34 | - $this->context->setCache( $this->cache ); |
|
34 | + $this->context->setCache($this->cache); |
|
35 | 35 | |
36 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Cache( $this->mock, $this->context, $templatePaths ); |
|
36 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Cache($this->mock, $this->context, $templatePaths); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | 40 | protected function tearDown() |
41 | 41 | { |
42 | - unset( $this->object, $this->mock, $this->context, $this->cache ); |
|
42 | + unset($this->object, $this->mock, $this->context, $this->cache); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | public function testSave() |
47 | 47 | { |
48 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
48 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
49 | 49 | |
50 | - $tags = array( 'product', 'product-' . $item->getId() ); |
|
50 | + $tags = array('product', 'product-' . $item->getId()); |
|
51 | 51 | $view = \TestHelperJqadm::getView(); |
52 | 52 | $view->item = $item; |
53 | 53 | |
54 | - $this->cache->expects( $this->once() )->method( 'deleteByTags' )->with( $this->equalTo( $tags ) ); |
|
55 | - $this->mock->expects( $this->once() )->method( 'save' )->will( $this->returnValue( 'test' ) ); |
|
54 | + $this->cache->expects($this->once())->method('deleteByTags')->with($this->equalTo($tags)); |
|
55 | + $this->mock->expects($this->once())->method('save')->will($this->returnValue('test')); |
|
56 | 56 | |
57 | - $this->object->setView( $view ); |
|
57 | + $this->object->setView($view); |
|
58 | 58 | $result = $this->object->save(); |
59 | 59 | |
60 | - $this->assertEquals( 'test', $result ); |
|
60 | + $this->assertEquals('test', $result); |
|
61 | 61 | } |
62 | 62 | } |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | $this->context = \TestHelperJqadm::getContext(); |
21 | 21 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
22 | 22 | |
23 | - $client = new \Aimeos\Admin\JQAdm\Product\Standard( $this->context, $templatePaths ); |
|
24 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $client, $this->context, $templatePaths ); |
|
23 | + $client = new \Aimeos\Admin\JQAdm\Product\Standard($this->context, $templatePaths); |
|
24 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($client, $this->context, $templatePaths); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | 28 | protected function tearDown() |
29 | 29 | { |
30 | - unset( $this->object, $this->context ); |
|
30 | + unset($this->object, $this->context); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | { |
36 | 36 | $view = \TestHelperJqadm::getView(); |
37 | 37 | |
38 | - $this->object->setView( $view ); |
|
38 | + $this->object->setView($view); |
|
39 | 39 | |
40 | - $this->assertInternalType( 'array', $view->pageSites ); |
|
41 | - $this->assertInternalType( 'array', $view->pageLanguages ); |
|
40 | + $this->assertInternalType('array', $view->pageSites); |
|
41 | + $this->assertInternalType('array', $view->pageLanguages); |
|
42 | 42 | } |
43 | 43 | } |
@@ -21,31 +21,31 @@ |
||
21 | 21 | $this->context = \TestHelperJqadm::getContext(); |
22 | 22 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
23 | 23 | |
24 | - $this->mock = $this->getMockBuilder( 'Aimeos\Admin\JQAdm\Product\Standard' ) |
|
25 | - ->setMethods( array( 'save' ) ) |
|
24 | + $this->mock = $this->getMockBuilder('Aimeos\Admin\JQAdm\Product\Standard') |
|
25 | + ->setMethods(array('save')) |
|
26 | 26 | ->disableOriginalConstructor() |
27 | 27 | ->getMock(); |
28 | 28 | |
29 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Index( $this->mock, $this->context, $templatePaths ); |
|
29 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Index($this->mock, $this->context, $templatePaths); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | protected function tearDown() |
34 | 34 | { |
35 | - unset( $this->object, $this->mock, $this->context ); |
|
35 | + unset($this->object, $this->mock, $this->context); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testSave() |
40 | 40 | { |
41 | 41 | $view = \TestHelperJqadm::getView(); |
42 | - $view->item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
42 | + $view->item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
43 | 43 | |
44 | - $this->mock->expects( $this->once() )->method( 'save' )->will( $this->returnValue( 'test' ) ); |
|
45 | - $this->object->setView( $view ); |
|
44 | + $this->mock->expects($this->once())->method('save')->will($this->returnValue('test')); |
|
45 | + $this->object->setView($view); |
|
46 | 46 | |
47 | 47 | $result = $this->object->save(); |
48 | 48 | |
49 | - $this->assertEquals( 'test', $result ); |
|
49 | + $this->assertEquals('test', $result); |
|
50 | 50 | } |
51 | 51 | } |
@@ -11,17 +11,17 @@ |
||
11 | 11 | * Set error reporting to maximum |
12 | 12 | */ |
13 | 13 | error_reporting( -1 ); |
14 | -ini_set( 'display_errors', '1' ); |
|
14 | +ini_set('display_errors', '1'); |
|
15 | 15 | |
16 | -date_default_timezone_set( 'UTC' ); |
|
16 | +date_default_timezone_set('UTC'); |
|
17 | 17 | |
18 | 18 | /* |
19 | 19 | * Set locale settings to reasonable defaults |
20 | 20 | */ |
21 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
22 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
23 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
24 | -setlocale( LC_TIME, 'POSIX' ); |
|
21 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
22 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
23 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
24 | +setlocale(LC_TIME, 'POSIX'); |
|
25 | 25 | |
26 | 26 | |
27 | 27 | require_once 'TestHelperJqadm.php'; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
35 | 35 | * and a list of relative paths inside the core or the extension as values |
36 | 36 | */ |
37 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
37 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths) |
|
38 | 38 | { |
39 | 39 | $this->context = $context; |
40 | 40 | $this->templatePaths = $templatePaths; |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getView() |
50 | 50 | { |
51 | - if( !isset( $this->view ) ) { |
|
52 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'No view available' ) ); |
|
51 | + if (!isset($this->view)) { |
|
52 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('No view available')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | return $this->view; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output |
63 | 63 | * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls |
64 | 64 | */ |
65 | - public function setView( \Aimeos\MW\View\Iface $view ) |
|
65 | + public function setView(\Aimeos\MW\View\Iface $view) |
|
66 | 66 | { |
67 | 67 | $this->view = $view; |
68 | 68 | return $this; |
@@ -98,29 +98,29 @@ discard block |
||
98 | 98 | * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Admin\JQAdm\Catalog\Decorator\" |
99 | 99 | * @return \Aimeos\Admin\JQAdm\Iface Admin object |
100 | 100 | */ |
101 | - protected function addDecorators( \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, |
|
102 | - array $decorators, $classprefix ) |
|
101 | + protected function addDecorators(\Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, |
|
102 | + array $decorators, $classprefix) |
|
103 | 103 | { |
104 | 104 | $iface = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\Iface'; |
105 | 105 | |
106 | - foreach( $decorators as $name ) |
|
106 | + foreach ($decorators as $name) |
|
107 | 107 | { |
108 | - if( ctype_alnum( $name ) === false ) |
|
108 | + if (ctype_alnum($name) === false) |
|
109 | 109 | { |
110 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
111 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) ); |
|
110 | + $classname = is_string($name) ? $classprefix . $name : '<not a string>'; |
|
111 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid class name "%1$s"', $classname)); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | $classname = $classprefix . $name; |
115 | 115 | |
116 | - if( class_exists( $classname ) === false ) { |
|
117 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
116 | + if (class_exists($classname) === false) { |
|
117 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
118 | 118 | } |
119 | 119 | |
120 | - $client = new $classname( $client, $this->context, $this->templatePaths ); |
|
120 | + $client = new $classname($client, $this->context, $this->templatePaths); |
|
121 | 121 | |
122 | - if( !( $client instanceof $iface ) ) { |
|
123 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ) ); |
|
122 | + if (!($client instanceof $iface)) { |
|
123 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $iface)); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -136,35 +136,35 @@ discard block |
||
136 | 136 | * @param string $path Admin string in lower case, e.g. "catalog/detail/basic" |
137 | 137 | * @return \Aimeos\Admin\JQAdm\Iface Admin object |
138 | 138 | */ |
139 | - protected function addClientDecorators( \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path ) |
|
139 | + protected function addClientDecorators(\Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path) |
|
140 | 140 | { |
141 | - if( !is_string( $path ) || $path === '' ) { |
|
142 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid domain "%1$s"', $path ) ); |
|
141 | + if (!is_string($path) || $path === '') { |
|
142 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid domain "%1$s"', $path)); |
|
143 | 143 | } |
144 | 144 | |
145 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
145 | + $localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path))); |
|
146 | 146 | $config = $this->context->getConfig(); |
147 | 147 | |
148 | - $decorators = $config->get( 'admin/jqadm/common/decorators/default', array() ); |
|
149 | - $excludes = $config->get( 'admin/jqadm/' . $path . '/decorators/excludes', array() ); |
|
148 | + $decorators = $config->get('admin/jqadm/common/decorators/default', array()); |
|
149 | + $excludes = $config->get('admin/jqadm/' . $path . '/decorators/excludes', array()); |
|
150 | 150 | |
151 | - foreach( $decorators as $key => $name ) |
|
151 | + foreach ($decorators as $key => $name) |
|
152 | 152 | { |
153 | - if( in_array( $name, $excludes ) ) { |
|
154 | - unset( $decorators[$key] ); |
|
153 | + if (in_array($name, $excludes)) { |
|
154 | + unset($decorators[$key]); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'; |
159 | - $client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix ); |
|
159 | + $client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix); |
|
160 | 160 | |
161 | 161 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'; |
162 | - $decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/global', array() ); |
|
163 | - $client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix ); |
|
162 | + $decorators = $config->get('admin/jqadm/' . $path . '/decorators/global', array()); |
|
163 | + $client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix); |
|
164 | 164 | |
165 | 165 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\' . $localClass . '\\Decorator\\'; |
166 | - $decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/local', array() ); |
|
167 | - $client = $this->addDecorators( $client, $templatePaths, $decorators, $classprefix ); |
|
166 | + $decorators = $config->get('admin/jqadm/' . $path . '/decorators/local', array()); |
|
167 | + $client = $this->addDecorators($client, $templatePaths, $decorators, $classprefix); |
|
168 | 168 | |
169 | 169 | return $client; |
170 | 170 | } |
@@ -177,35 +177,35 @@ discard block |
||
177 | 177 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
178 | 178 | * @return \Aimeos\Admin\JQAdm\Iface Sub-part object |
179 | 179 | */ |
180 | - protected function createSubClient( $path, $name ) |
|
180 | + protected function createSubClient($path, $name) |
|
181 | 181 | { |
182 | - $path = strtolower( $path ); |
|
182 | + $path = strtolower($path); |
|
183 | 183 | |
184 | - if( $name === null ) { |
|
185 | - $name = $this->context->getConfig()->get( 'admin/jqadm/' . $path . '/name', 'Standard' ); |
|
184 | + if ($name === null) { |
|
185 | + $name = $this->context->getConfig()->get('admin/jqadm/' . $path . '/name', 'Standard'); |
|
186 | 186 | } |
187 | 187 | |
188 | - if( empty( $name ) || ctype_alnum( $name ) === false ) { |
|
189 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in client name "%1$s"', $name ) ); |
|
188 | + if (empty($name) || ctype_alnum($name) === false) { |
|
189 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in client name "%1$s"', $name)); |
|
190 | 190 | } |
191 | 191 | |
192 | - $subnames = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
192 | + $subnames = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path))); |
|
193 | 193 | |
194 | 194 | $classname = '\\Aimeos\\Admin\\JQAdm\\' . $subnames . '\\' . $name; |
195 | 195 | $interface = '\\Aimeos\\Admin\\JQAdm\\Iface'; |
196 | 196 | |
197 | - if( class_exists( $classname ) === false ) { |
|
198 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
197 | + if (class_exists($classname) === false) { |
|
198 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
199 | 199 | } |
200 | 200 | |
201 | - $object = new $classname( $this->context, $this->templatePaths ); |
|
201 | + $object = new $classname($this->context, $this->templatePaths); |
|
202 | 202 | |
203 | - if( ( $object instanceof $interface ) === false ) { |
|
204 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) ); |
|
203 | + if (($object instanceof $interface) === false) { |
|
204 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $interface)); |
|
205 | 205 | } |
206 | 206 | |
207 | - $object = $this->addClientDecorators( $object, $this->templatePaths, $path ); |
|
208 | - $object->setView( $this->view ); |
|
207 | + $object = $this->addClientDecorators($object, $this->templatePaths, $path); |
|
208 | + $object->setView($this->view); |
|
209 | 209 | |
210 | 210 | return $object; |
211 | 211 | } |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | * @param array $names List of parameter names |
218 | 218 | * @return array Associative list of parameters names as key and their values |
219 | 219 | */ |
220 | - protected function getClientParams( $names = array( 'resource', 'site', 'lang', 'fields', 'filter', 'page', 'sort' ) ) |
|
220 | + protected function getClientParams($names = array('resource', 'site', 'lang', 'fields', 'filter', 'page', 'sort')) |
|
221 | 221 | { |
222 | 222 | $list = array(); |
223 | 223 | |
224 | - foreach( $names as $name ) |
|
224 | + foreach ($names as $name) |
|
225 | 225 | { |
226 | - if( ( $val = $this->view->param( $name ) ) !== null ) { |
|
226 | + if (($val = $this->view->param($name)) !== null) { |
|
227 | 227 | $list[$name] = $val; |
228 | 228 | } |
229 | 229 | } |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | */ |
259 | 259 | protected function getSubClients() |
260 | 260 | { |
261 | - if( !isset( $this->subclients ) ) |
|
261 | + if (!isset($this->subclients)) |
|
262 | 262 | { |
263 | 263 | $this->subclients = array(); |
264 | 264 | |
265 | - foreach( $this->getSubClientNames() as $name ) { |
|
266 | - $this->subclients[] = $this->getSubClient( $name ); |
|
265 | + foreach ($this->getSubClientNames() as $name) { |
|
266 | + $this->subclients[] = $this->getSubClient($name); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | * @param array $params List of criteria data with condition, sorting and paging |
290 | 290 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
291 | 291 | */ |
292 | - protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
292 | + protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
293 | 293 | { |
294 | - $this->initCriteriaConditions( $criteria, $params ); |
|
295 | - $this->initCriteriaSortations( $criteria, $params ); |
|
296 | - $this->initCriteriaSlice( $criteria, $params ); |
|
294 | + $this->initCriteriaConditions($criteria, $params); |
|
295 | + $this->initCriteriaSortations($criteria, $params); |
|
296 | + $this->initCriteriaSlice($criteria, $params); |
|
297 | 297 | |
298 | 298 | return $criteria; |
299 | 299 | } |
@@ -305,24 +305,24 @@ discard block |
||
305 | 305 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
306 | 306 | * @param array $params List of criteria data with condition, sorting and paging |
307 | 307 | */ |
308 | - private function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
308 | + private function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
309 | 309 | { |
310 | - if( isset( $params['filter'] ) && isset( $params['filter']['key'] ) ) |
|
310 | + if (isset($params['filter']) && isset($params['filter']['key'])) |
|
311 | 311 | { |
312 | 312 | $expr = array(); |
313 | 313 | $existing = $criteria->getConditions(); |
314 | 314 | |
315 | - foreach( (array) $params['filter']['key'] as $idx => $key ) |
|
315 | + foreach ((array) $params['filter']['key'] as $idx => $key) |
|
316 | 316 | { |
317 | - if( $key != '' && isset( $params['filter']['op'][$idx] ) && $params['filter']['op'][$idx] != '' |
|
318 | - && isset( $params['filter']['val'][$idx] ) |
|
317 | + if ($key != '' && isset($params['filter']['op'][$idx]) && $params['filter']['op'][$idx] != '' |
|
318 | + && isset($params['filter']['val'][$idx]) |
|
319 | 319 | ) { |
320 | - $expr[] = $criteria->compare( $params['filter']['op'][$idx], $key, $params['filter']['val'][$idx] ); |
|
320 | + $expr[] = $criteria->compare($params['filter']['op'][$idx], $key, $params['filter']['val'][$idx]); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | 324 | $expr[] = $existing; |
325 | - $criteria->setConditions( $criteria->combine( '&&', $expr ) ); |
|
325 | + $criteria->setConditions($criteria->combine('&&', $expr)); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
@@ -333,12 +333,12 @@ discard block |
||
333 | 333 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
334 | 334 | * @param array $params List of criteria data with condition, sorting and paging |
335 | 335 | */ |
336 | - private function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
336 | + private function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
337 | 337 | { |
338 | - $start = ( isset( $params['page']['offset'] ) ? $params['page']['offset'] : 0 ); |
|
339 | - $size = ( isset( $params['page']['limit'] ) ? $params['page']['limit'] : 100 ); |
|
338 | + $start = (isset($params['page']['offset']) ? $params['page']['offset'] : 0); |
|
339 | + $size = (isset($params['page']['limit']) ? $params['page']['limit'] : 100); |
|
340 | 340 | |
341 | - $criteria->setSlice( $start, $size ); |
|
341 | + $criteria->setSlice($start, $size); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
@@ -348,23 +348,23 @@ discard block |
||
348 | 348 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
349 | 349 | * @param array $params List of criteria data with condition, sorting and paging |
350 | 350 | */ |
351 | - private function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
351 | + private function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
352 | 352 | { |
353 | - if( !isset( $params['sort'] ) ) { |
|
353 | + if (!isset($params['sort'])) { |
|
354 | 354 | return; |
355 | 355 | } |
356 | 356 | |
357 | 357 | $sortation = array(); |
358 | 358 | |
359 | - foreach( (array) $params['sort'] as $sort ) |
|
359 | + foreach ((array) $params['sort'] as $sort) |
|
360 | 360 | { |
361 | - if( $sort[0] === '-' ) { |
|
362 | - $sortation[] = $criteria->sort( '-', substr( $sort, 1 ) ); |
|
361 | + if ($sort[0] === '-') { |
|
362 | + $sortation[] = $criteria->sort('-', substr($sort, 1)); |
|
363 | 363 | } else { |
364 | - $sortation[] = $criteria->sort( '+', $sort ); break; |
|
364 | + $sortation[] = $criteria->sort('+', $sort); break; |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
368 | - $criteria->setSortations( $sortation ); |
|
368 | + $criteria->setSortations($sortation); |
|
369 | 369 | } |
370 | 370 | } |