@@ -22,44 +22,44 @@ discard block |
||
| 22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
| 23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
| 24 | 24 | |
| 25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Selection\Standard( $this->context, $templatePaths ); |
|
| 26 | - $this->object->setView( $this->view ); |
|
| 25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Selection\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->assertNull( $this->view->get( 'errors' ) ); |
|
| 44 | - $this->assertStringStartsWith( '<div class="product-item-selection', $result ); |
|
| 43 | + $this->assertNull($this->view->get('errors')); |
|
| 44 | + $this->assertStringStartsWith('<div class="product-item-selection', $result); |
|
| 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( 'U:TEST', array( 'product' ) ); |
|
| 52 | + $this->view->item = $manager->findItem('U:TEST', array('product')); |
|
| 53 | 53 | $result = $this->object->copy(); |
| 54 | 54 | |
| 55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
| 56 | - $this->assertContains( 'U:TESTSUB01', $result ); |
|
| 57 | - $this->assertContains( 'U:TESTSUB02', $result ); |
|
| 58 | - $this->assertContains( 'U:TESTSUB03', $result ); |
|
| 59 | - $this->assertContains( 'U:TESTSUB04', $result ); |
|
| 60 | - $this->assertContains( 'U:TESTSUB05', $result ); |
|
| 61 | - $this->assertContains( 'value="30"', $result ); |
|
| 62 | - $this->assertContains( 'value="32"', $result ); |
|
| 55 | + $this->assertNull($this->view->get('errors')); |
|
| 56 | + $this->assertContains('U:TESTSUB01', $result); |
|
| 57 | + $this->assertContains('U:TESTSUB02', $result); |
|
| 58 | + $this->assertContains('U:TESTSUB03', $result); |
|
| 59 | + $this->assertContains('U:TESTSUB04', $result); |
|
| 60 | + $this->assertContains('U:TESTSUB05', $result); |
|
| 61 | + $this->assertContains('value="30"', $result); |
|
| 62 | + $this->assertContains('value="32"', $result); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -67,83 +67,83 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $param = array( |
| 69 | 69 | 'selection' => array( |
| 70 | - 'product.id' => array( 0 => '' ), |
|
| 71 | - 'product.code' => array( 0 => 'testprod' ), |
|
| 72 | - 'product.label' => array( 0 => 'test product' ), |
|
| 70 | + 'product.id' => array(0 => ''), |
|
| 71 | + 'product.code' => array(0 => 'testprod'), |
|
| 72 | + 'product.label' => array(0 => 'test product'), |
|
| 73 | 73 | 'attr' => array( |
| 74 | - 'id' => array( 0 => '123' ), |
|
| 75 | - 'label' => array( 0 => 'test attribute' ), |
|
| 76 | - 'ref' => array( 0 => 'testprod' ), |
|
| 74 | + 'id' => array(0 => '123'), |
|
| 75 | + 'label' => array(0 => 'test attribute'), |
|
| 76 | + 'ref' => array(0 => 'testprod'), |
|
| 77 | 77 | ) |
| 78 | 78 | ), |
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 82 | - $this->view->addHelper( 'param', $helper ); |
|
| 81 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 82 | + $this->view->addHelper('param', $helper); |
|
| 83 | 83 | |
| 84 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
| 85 | - $this->view->item = $manager->findItem( 'U:TEST' ); |
|
| 84 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
| 85 | + $this->view->item = $manager->findItem('U:TEST'); |
|
| 86 | 86 | |
| 87 | 87 | $result = $this->object->get(); |
| 88 | 88 | |
| 89 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
| 90 | - $this->assertContains( 'testprod', $result ); |
|
| 91 | - $this->assertContains( 'value="123"', $result ); |
|
| 89 | + $this->assertNull($this->view->get('errors')); |
|
| 90 | + $this->assertContains('testprod', $result); |
|
| 91 | + $this->assertContains('value="123"', $result); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | public function testSave() |
| 96 | 96 | { |
| 97 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
| 97 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
| 98 | 98 | |
| 99 | - $item = $manager->findItem( 'U:TEST' ); |
|
| 100 | - $item->setCode( 'jqadm-test-selection' ); |
|
| 101 | - $item->setId( null ); |
|
| 99 | + $item = $manager->findItem('U:TEST'); |
|
| 100 | + $item->setCode('jqadm-test-selection'); |
|
| 101 | + $item->setId(null); |
|
| 102 | 102 | |
| 103 | - $manager->saveItem( $item ); |
|
| 103 | + $manager->saveItem($item); |
|
| 104 | 104 | |
| 105 | - $attrManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
| 106 | - $attrItem = $attrManager->findItem( 'xs', array(), 'product', 'size' ); |
|
| 105 | + $attrManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
| 106 | + $attrItem = $attrManager->findItem('xs', array(), 'product', 'size'); |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | $param = array( |
| 110 | 110 | 'selection' => array( |
| 111 | - 'product.lists.id' => array( 0 => '' ), |
|
| 112 | - 'product.id' => array( 0 => $item->getId() ), |
|
| 113 | - 'product.code' => array( 0 => 'testprod' ), |
|
| 114 | - 'product.label' => array( 0 => 'test product' ), |
|
| 111 | + 'product.lists.id' => array(0 => ''), |
|
| 112 | + 'product.id' => array(0 => $item->getId()), |
|
| 113 | + 'product.code' => array(0 => 'testprod'), |
|
| 114 | + 'product.label' => array(0 => 'test product'), |
|
| 115 | 115 | 'attr' => array( |
| 116 | - 'id' => array( 0 => $attrItem->getId() ), |
|
| 117 | - 'label' => array( 0 => 'test attribute' ), |
|
| 118 | - 'ref' => array( 0 => 'testprod' ), |
|
| 116 | + 'id' => array(0 => $attrItem->getId()), |
|
| 117 | + 'label' => array(0 => 'test attribute'), |
|
| 118 | + 'ref' => array(0 => 'testprod'), |
|
| 119 | 119 | ) |
| 120 | 120 | ), |
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
| 124 | - $this->view->addHelper( 'param', $helper ); |
|
| 123 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
| 124 | + $this->view->addHelper('param', $helper); |
|
| 125 | 125 | $this->view->item = $item; |
| 126 | 126 | |
| 127 | 127 | $result = $this->object->save(); |
| 128 | 128 | |
| 129 | - $item = $manager->getItem( $item->getId(), array( 'product' ) ); |
|
| 130 | - $variants = $item->getListItems( 'product', 'default' ); |
|
| 129 | + $item = $manager->getItem($item->getId(), array('product')); |
|
| 130 | + $variants = $item->getListItems('product', 'default'); |
|
| 131 | 131 | |
| 132 | - if( empty( $variants ) ) { |
|
| 133 | - throw new \Exception( 'No variant products available' ); |
|
| 132 | + if (empty($variants)) { |
|
| 133 | + throw new \Exception('No variant products available'); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - $variant = $manager->getItem( reset( $variants )->getRefId(), array( 'attribute' ) ); |
|
| 137 | - $attributes = $variant->getListItems( 'attribute', 'variant' ); |
|
| 136 | + $variant = $manager->getItem(reset($variants)->getRefId(), array('attribute')); |
|
| 137 | + $attributes = $variant->getListItems('attribute', 'variant'); |
|
| 138 | 138 | |
| 139 | - $manager->deleteItems( array( $item->getId(), $variant->getId() ) ); |
|
| 139 | + $manager->deleteItems(array($item->getId(), $variant->getId())); |
|
| 140 | 140 | |
| 141 | 141 | |
| 142 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
| 143 | - $this->assertNull( $result ); |
|
| 144 | - $this->assertEquals( 1, count( $variants ) ); |
|
| 145 | - $this->assertEquals( 1, count( $attributes ) ); |
|
| 146 | - $this->assertEquals( 'testprod', $variant->getCode() ); |
|
| 147 | - $this->assertEquals( $attrItem->getId(), reset( $attributes )->getRefId() ); |
|
| 142 | + $this->assertNull($this->view->get('errors')); |
|
| 143 | + $this->assertNull($result); |
|
| 144 | + $this->assertEquals(1, count($variants)); |
|
| 145 | + $this->assertEquals(1, count($attributes)); |
|
| 146 | + $this->assertEquals('testprod', $variant->getCode()); |
|
| 147 | + $this->assertEquals($attrItem->getId(), reset($attributes)->getRefId()); |
|
| 148 | 148 | } |
| 149 | 149 | } |
@@ -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 | } |
@@ -13,48 +13,48 @@ discard block |
||
| 13 | 13 | public static function bootstrap() |
| 14 | 14 | { |
| 15 | 15 | self::getAimeos(); |
| 16 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 17 | - \Aimeos\Controller\Frontend\Factory::setCache( false ); |
|
| 16 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 17 | + \Aimeos\Controller\Frontend\Factory::setCache(false); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - public static function getContext( $site = 'unittest' ) |
|
| 21 | + public static function getContext($site = 'unittest') |
|
| 22 | 22 | { |
| 23 | - if( !isset( self::$context[$site] ) ) { |
|
| 24 | - self::$context[$site] = self::createContext( $site ); |
|
| 23 | + if (!isset(self::$context[$site])) { |
|
| 24 | + self::$context[$site] = self::createContext($site); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | return clone self::$context[$site]; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | - public static function getView( $site = 'unittest', \Aimeos\MW\Config\Iface $config = null ) |
|
| 31 | + public static function getView($site = 'unittest', \Aimeos\MW\Config\Iface $config = null) |
|
| 32 | 32 | { |
| 33 | - if( $config === null ) { |
|
| 34 | - $config = self::getContext( $site )->getConfig(); |
|
| 33 | + if ($config === null) { |
|
| 34 | + $config = self::getContext($site)->getConfig(); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $view = new \Aimeos\MW\View\Standard( self::getTemplatePaths() ); |
|
| 37 | + $view = new \Aimeos\MW\View\Standard(self::getTemplatePaths()); |
|
| 38 | 38 | |
| 39 | - $trans = new \Aimeos\MW\Translation\None( 'de_DE' ); |
|
| 40 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans ); |
|
| 41 | - $view->addHelper( 'translate', $helper ); |
|
| 39 | + $trans = new \Aimeos\MW\Translation\None('de_DE'); |
|
| 40 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans); |
|
| 41 | + $view->addHelper('translate', $helper); |
|
| 42 | 42 | |
| 43 | - $helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' ); |
|
| 44 | - $view->addHelper( 'url', $helper ); |
|
| 43 | + $helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl'); |
|
| 44 | + $view->addHelper('url', $helper); |
|
| 45 | 45 | |
| 46 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' ); |
|
| 47 | - $view->addHelper( 'number', $helper ); |
|
| 46 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', ''); |
|
| 47 | + $view->addHelper('number', $helper); |
|
| 48 | 48 | |
| 49 | - $helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' ); |
|
| 50 | - $view->addHelper( 'date', $helper ); |
|
| 49 | + $helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d'); |
|
| 50 | + $view->addHelper('date', $helper); |
|
| 51 | 51 | |
| 52 | - $config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'admin', 'client/html', 'controller/jsonadm' ) ); |
|
| 53 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
| 54 | - $view->addHelper( 'config', $helper ); |
|
| 52 | + $config = new \Aimeos\MW\Config\Decorator\Protect($config, array('admin', 'client/html', 'controller/jsonadm')); |
|
| 53 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
| 54 | + $view->addHelper('config', $helper); |
|
| 55 | 55 | |
| 56 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_csrf_token', '_csrf_value' ); |
|
| 57 | - $view->addHelper( 'csrf', $helper ); |
|
| 56 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_csrf_token', '_csrf_value'); |
|
| 57 | + $view->addHelper('csrf', $helper); |
|
| 58 | 58 | |
| 59 | 59 | return $view; |
| 60 | 60 | } |
@@ -62,19 +62,19 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public static function getTemplatePaths() |
| 64 | 64 | { |
| 65 | - return self::getAimeos()->getCustomPaths( 'admin/jqadm/templates' ); |
|
| 65 | + return self::getAimeos()->getCustomPaths('admin/jqadm/templates'); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | private static function getAimeos() |
| 70 | 70 | { |
| 71 | - if( !isset( self::$aimeos ) ) |
|
| 71 | + if (!isset(self::$aimeos)) |
|
| 72 | 72 | { |
| 73 | 73 | require_once 'Bootstrap.php'; |
| 74 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
| 74 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
| 75 | 75 | |
| 76 | - $extdir = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ); |
|
| 77 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false ); |
|
| 76 | + $extdir = dirname(dirname(dirname(dirname(__FILE__)))); |
|
| 77 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return self::$aimeos; |
@@ -84,53 +84,53 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * @param string $site |
| 86 | 86 | */ |
| 87 | - private static function createContext( $site ) |
|
| 87 | + private static function createContext($site) |
|
| 88 | 88 | { |
| 89 | 89 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
| 90 | 90 | $aimeos = self::getAimeos(); |
| 91 | 91 | |
| 92 | 92 | |
| 93 | - $paths = $aimeos->getConfigPaths( 'mysql' ); |
|
| 93 | + $paths = $aimeos->getConfigPaths('mysql'); |
|
| 94 | 94 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
| 95 | 95 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
| 96 | - $local = array( 'resource' => array( 'fs' => array( 'adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp' ) ) ); |
|
| 96 | + $local = array('resource' => array('fs' => array('adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp'))); |
|
| 97 | 97 | |
| 98 | - $conf = new \Aimeos\MW\Config\PHPArray( $local, $paths ); |
|
| 99 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
| 100 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
| 101 | - $ctx->setConfig( $conf ); |
|
| 98 | + $conf = new \Aimeos\MW\Config\PHPArray($local, $paths); |
|
| 99 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
| 100 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
| 101 | + $ctx->setConfig($conf); |
|
| 102 | 102 | |
| 103 | 103 | |
| 104 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
| 105 | - $ctx->setDatabaseManager( $dbm ); |
|
| 104 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
| 105 | + $ctx->setDatabaseManager($dbm); |
|
| 106 | 106 | |
| 107 | 107 | |
| 108 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf ); |
|
| 109 | - $ctx->setFilesystemManager( $fs ); |
|
| 108 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf); |
|
| 109 | + $ctx->setFilesystemManager($fs); |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | - $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
| 113 | - $ctx->setLogger( $logger ); |
|
| 112 | + $logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
| 113 | + $ctx->setLogger($logger); |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | $cache = new \Aimeos\MW\Cache\None(); |
| 117 | - $ctx->setCache( $cache ); |
|
| 117 | + $ctx->setCache($cache); |
|
| 118 | 118 | |
| 119 | 119 | |
| 120 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
| 121 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
| 120 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
| 121 | + $ctx->setI18n(array('de' => $i18n)); |
|
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | $session = new \Aimeos\MW\Session\None(); |
| 125 | - $ctx->setSession( $session ); |
|
| 125 | + $ctx->setSession($session); |
|
| 126 | 126 | |
| 127 | 127 | |
| 128 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
| 129 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
| 130 | - $ctx->setLocale( $locale ); |
|
| 128 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 129 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
| 130 | + $ctx->setLocale($locale); |
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | - $ctx->setEditor( 'core:admin/jqadm' ); |
|
| 133 | + $ctx->setEditor('core:admin/jqadm'); |
|
| 134 | 134 | |
| 135 | 135 | return $ctx; |
| 136 | 136 | } |