@@ -5,9 +5,9 @@ discard block |
||
5 | 5 | * @copyright Aimeos (aimeos.org), 2016 |
6 | 6 | */ |
7 | 7 | |
8 | -$selected = function( $key, $code ) { |
|
9 | -error_log( 'key: ' . $key . ': ' . $code . '<br/>' ); |
|
10 | - return ( $key == $code ? 'selected="selected"' : '' ); |
|
8 | +$selected = function($key, $code) { |
|
9 | +error_log('key: ' . $key . ': ' . $code . '<br/>'); |
|
10 | + return ($key == $code ? 'selected="selected"' : ''); |
|
11 | 11 | }; |
12 | 12 | |
13 | 13 | $enc = $this->encoder(); |
@@ -17,54 +17,54 @@ discard block |
||
17 | 17 | <table class="property-list table table-default"> |
18 | 18 | <thead> |
19 | 19 | <tr> |
20 | - <th colspan="3"><?php echo $enc->html( $this->translate( 'admin', 'Properties' ) ); ?></th> |
|
20 | + <th colspan="3"><?php echo $enc->html($this->translate('admin', 'Properties')); ?></th> |
|
21 | 21 | <th class="actions"><div class="btn btn-primary fa fa-plus"></div></th> |
22 | 22 | </tr> |
23 | 23 | </thead> |
24 | 24 | <tbody> |
25 | -<?php foreach( $this->get( 'propertyData/product.property.id', array() ) as $idx => $id ) : ?> |
|
25 | +<?php foreach ($this->get('propertyData/product.property.id', array()) as $idx => $id) : ?> |
|
26 | 26 | <tr> |
27 | 27 | <td class="property-type"> |
28 | - <input class="item-id" type="hidden" name="<?php echo $enc->attr( $this->formparam( array( 'characteristic', 'property', 'product.property.id', '' ) ) ); ?>" value="<?php echo $enc->attr( $id ); ?>" /> |
|
29 | - <select class="c-select item-typeid" name="<?php echo $enc->attr( $this->formparam( array( 'characteristic', 'property', 'product.property.typeid', '' ) ) ); ?>"> |
|
30 | -<?php foreach( $this->get( 'propertyTypes', array() ) as $typeid => $item ) : ?> |
|
31 | - <option value="<?php echo $enc->attr( $typeid ); ?>" <?php echo $selected( $this->get( 'propertyData/product.property.typeid/' . $idx ), $typeid ); ?> ><?php echo $enc->html( $item->getLabel() ); ?></option> |
|
28 | + <input class="item-id" type="hidden" name="<?php echo $enc->attr($this->formparam(array('characteristic', 'property', 'product.property.id', ''))); ?>" value="<?php echo $enc->attr($id); ?>" /> |
|
29 | + <select class="c-select item-typeid" name="<?php echo $enc->attr($this->formparam(array('characteristic', 'property', 'product.property.typeid', ''))); ?>"> |
|
30 | +<?php foreach ($this->get('propertyTypes', array()) as $typeid => $item) : ?> |
|
31 | + <option value="<?php echo $enc->attr($typeid); ?>" <?php echo $selected($this->get('propertyData/product.property.typeid/' . $idx), $typeid); ?> ><?php echo $enc->html($item->getLabel()); ?></option> |
|
32 | 32 | <?php endforeach; ?> |
33 | 33 | </select> |
34 | 34 | </td> |
35 | 35 | <td class="property-language"> |
36 | - <select class="combobox item-languageid" name="<?php echo $enc->attr( $this->formparam( array( 'characteristic', 'property', 'product.property.languageid', '' ) ) ); ?>"> |
|
37 | - <option value="<?php echo $enc->attr( $this->get( 'propertyData/product.property.languageid/' . $idx ) ); ?>" selected="selected"><?php echo $enc->html( $this->get( 'propertyData/product.property.languageid/' . $idx ) ) ?></option> |
|
36 | + <select class="combobox item-languageid" name="<?php echo $enc->attr($this->formparam(array('characteristic', 'property', 'product.property.languageid', ''))); ?>"> |
|
37 | + <option value="<?php echo $enc->attr($this->get('propertyData/product.property.languageid/' . $idx)); ?>" selected="selected"><?php echo $enc->html($this->get('propertyData/product.property.languageid/' . $idx)) ?></option> |
|
38 | 38 | </select> |
39 | 39 | </td> |
40 | 40 | <td class="property-value"> |
41 | - <input class="form-control item-value" type="text" name="<?php echo $enc->attr( $this->formparam( array( 'characteristic', 'property', 'product.property.value', '' ) ) ); ?>" |
|
42 | - placeholder="<?php echo $enc->attr( $this->translate( 'admin', 'Property value (required)' ) ); ?>" |
|
43 | - value="<?php echo $enc->attr( $this->get( 'propertyData/product.property.value/' . $idx ) ); ?>" /> |
|
41 | + <input class="form-control item-value" type="text" name="<?php echo $enc->attr($this->formparam(array('characteristic', 'property', 'product.property.value', ''))); ?>" |
|
42 | + placeholder="<?php echo $enc->attr($this->translate('admin', 'Property value (required)')); ?>" |
|
43 | + value="<?php echo $enc->attr($this->get('propertyData/product.property.value/' . $idx)); ?>" /> |
|
44 | 44 | </td> |
45 | 45 | <td class="actions"><div class="btn btn-danger fa fa-trash"></div></td> |
46 | 46 | </tr> |
47 | 47 | <?php endforeach; ?> |
48 | 48 | <tr class="prototype"> |
49 | 49 | <td class="property-type"> |
50 | - <input class="item-id" type="hidden" name="<?php echo $enc->attr( $this->formparam( array( 'characteristic', 'property', 'product.property.id', '' ) ) ); ?>" value="" disabled="disabled" /> |
|
51 | - <select class="c-select item-typeid" name="<?php echo $enc->attr( $this->formparam( array( 'characteristic', 'property', 'product.property.typeid', '' ) ) ); ?>" disabled="disabled"> |
|
52 | -<?php foreach( $this->get( 'propertyTypes', array() ) as $typeid => $item ) : ?> |
|
53 | - <option value="<?php echo $enc->attr( $typeid ); ?>" ><?php echo $enc->html( $item->getLabel() ); ?></option> |
|
50 | + <input class="item-id" type="hidden" name="<?php echo $enc->attr($this->formparam(array('characteristic', 'property', 'product.property.id', ''))); ?>" value="" disabled="disabled" /> |
|
51 | + <select class="c-select item-typeid" name="<?php echo $enc->attr($this->formparam(array('characteristic', 'property', 'product.property.typeid', ''))); ?>" disabled="disabled"> |
|
52 | +<?php foreach ($this->get('propertyTypes', array()) as $typeid => $item) : ?> |
|
53 | + <option value="<?php echo $enc->attr($typeid); ?>" ><?php echo $enc->html($item->getLabel()); ?></option> |
|
54 | 54 | <?php endforeach; ?> |
55 | 55 | </select> |
56 | 56 | </td> |
57 | 57 | <td class="property-language"> |
58 | - <select class="combobox-prototype item-languageid" name="<?php echo $enc->attr( $this->formparam( array( 'characteristic', 'property', 'product.property.languageid', '' ) ) ); ?>" disabled="disabled"> |
|
58 | + <select class="combobox-prototype item-languageid" name="<?php echo $enc->attr($this->formparam(array('characteristic', 'property', 'product.property.languageid', ''))); ?>" disabled="disabled"> |
|
59 | 59 | </select> |
60 | 60 | </td> |
61 | 61 | <td class="property-value"> |
62 | - <input class="form-control item-value" type="text" name="<?php echo $enc->attr( $this->formparam( array( 'characteristic', 'property', 'product.property.value', '' ) ) ); ?>" |
|
63 | - placeholder="<?php echo $enc->attr( $this->translate( 'admin', 'Property value (required)' ) ); ?>" value="" disabled="disabled" /> |
|
62 | + <input class="form-control item-value" type="text" name="<?php echo $enc->attr($this->formparam(array('characteristic', 'property', 'product.property.value', ''))); ?>" |
|
63 | + placeholder="<?php echo $enc->attr($this->translate('admin', 'Property value (required)')); ?>" value="" disabled="disabled" /> |
|
64 | 64 | </td> |
65 | 65 | <td class="actions"><div class="btn btn-danger fa fa-trash"></div></td> |
66 | 66 | </tr> |
67 | 67 | </tbody> |
68 | 68 | </table> |
69 | -<?php echo $this->get( 'propertyBody' ); ?> |
|
69 | +<?php echo $this->get('propertyBody'); ?> |
|
70 | 70 | </div> |
@@ -17,42 +17,42 @@ |
||
17 | 17 | { |
18 | 18 | $this->templatePaths = \TestHelperJqadm::getTemplatePaths(); |
19 | 19 | $this->context = \TestHelperJqadm::getContext(); |
20 | - $this->context->setView( \TestHelperJqadm::getView() ); |
|
20 | + $this->context->setView(\TestHelperJqadm::getView()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | public function testCreateClient() |
25 | 25 | { |
26 | - $client = \Aimeos\Admin\JQAdm\Factory::createClient( $this->context, $this->templatePaths, 'product' ); |
|
27 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
26 | + $client = \Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->templatePaths, 'product'); |
|
27 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testCreateClientName() |
32 | 32 | { |
33 | - $client = \Aimeos\Admin\JQAdm\Factory::createClient( $this->context, $this->templatePaths, 'product', 'Standard' ); |
|
34 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
33 | + $client = \Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->templatePaths, 'product', 'Standard'); |
|
34 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testCreateClientNameEmpty() |
39 | 39 | { |
40 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
41 | - \Aimeos\Admin\JQAdm\Factory::createClient( $this->context, $this->templatePaths, '' ); |
|
40 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
41 | + \Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->templatePaths, ''); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testCreateClientNameInvalid() |
46 | 46 | { |
47 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
48 | - \Aimeos\Admin\JQAdm\Factory::createClient( $this->context, $this->templatePaths, '%product' ); |
|
47 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
48 | + \Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->templatePaths, '%product'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | public function testCreateClientNameNotFound() |
53 | 53 | { |
54 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
55 | - \Aimeos\Admin\JQAdm\Factory::createClient( $this->context, $this->templatePaths, 'prod' ); |
|
54 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
55 | + \Aimeos\Admin\JQAdm\Factory::createClient($this->context, $this->templatePaths, 'prod'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | } |
@@ -22,38 +22,38 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Characteristic\Attribute\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Characteristic\Attribute\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( 'Attributes', $result ); |
|
44 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
43 | + $this->assertContains('Attributes', $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( 'attribute' ) ); |
|
52 | + $this->view->item = $manager->findItem('CNC', array('attribute')); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'xs', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('xs', $result); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -61,61 +61,61 @@ discard block |
||
61 | 61 | { |
62 | 62 | $result = $this->object->delete(); |
63 | 63 | |
64 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
65 | - $this->assertNull( $result ); |
|
64 | + $this->assertNull($this->view->get('errors')); |
|
65 | + $this->assertNull($result); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testGet() |
70 | 70 | { |
71 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
72 | 72 | |
73 | - $this->view->item = $manager->findItem( 'CNC', array( 'attribute' ) ); |
|
73 | + $this->view->item = $manager->findItem('CNC', array('attribute')); |
|
74 | 74 | $result = $this->object->get(); |
75 | 75 | |
76 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
77 | - $this->assertContains( 'xs', $result ); |
|
76 | + $this->assertNull($this->view->get('errors')); |
|
77 | + $this->assertContains('xs', $result); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | 81 | public function testSave() |
82 | 82 | { |
83 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
84 | - $attrManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
83 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
84 | + $attrManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
85 | 85 | |
86 | - $item = $manager->findItem( 'CNC' ); |
|
87 | - $item->setCode( 'jqadm-test-attribute' ); |
|
88 | - $item->setId( null ); |
|
86 | + $item = $manager->findItem('CNC'); |
|
87 | + $item->setCode('jqadm-test-attribute'); |
|
88 | + $item->setId(null); |
|
89 | 89 | |
90 | - $manager->saveItem( $item ); |
|
90 | + $manager->saveItem($item); |
|
91 | 91 | |
92 | 92 | |
93 | 93 | $param = array( |
94 | 94 | 'characteristic' => array( |
95 | 95 | 'attribute' => array( |
96 | - 'product.lists.id' => array( '' ), |
|
97 | - 'product.lists.refid' => array( $attrManager->findItem( 'xs', array(), 'product', 'size' )->getId() ), |
|
96 | + 'product.lists.id' => array(''), |
|
97 | + 'product.lists.refid' => array($attrManager->findItem('xs', array(), 'product', 'size')->getId()), |
|
98 | 98 | ), |
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 | $this->view->item = $item; |
105 | 105 | |
106 | 106 | $result = $this->object->save(); |
107 | 107 | |
108 | - $item = $manager->getItem( $item->getId(), array( 'attribute' ) ); |
|
109 | - $manager->deleteItem( $item->getId() ); |
|
108 | + $item = $manager->getItem($item->getId(), array('attribute')); |
|
109 | + $manager->deleteItem($item->getId()); |
|
110 | 110 | |
111 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
112 | - $this->assertNull( $result ); |
|
113 | - $this->assertEquals( 1, count( $item->getListItems( 'attribute' ) ) ); |
|
111 | + $this->assertNull($this->view->get('errors')); |
|
112 | + $this->assertNull($result); |
|
113 | + $this->assertEquals(1, count($item->getListItems('attribute'))); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | 117 | public function testSearch() |
118 | 118 | { |
119 | - $this->assertNull( $this->object->search() ); |
|
119 | + $this->assertNull($this->object->search()); |
|
120 | 120 | } |
121 | 121 | } |
@@ -22,38 +22,38 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Characteristic\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Characteristic\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->assertContains( 'attribute-list', $result ); |
|
43 | + $this->assertNull($this->view->get('errors')); |
|
44 | + $this->assertContains('attribute-list', $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( '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( 'attribute-list', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('attribute-list', $result); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -61,58 +61,58 @@ discard block |
||
61 | 61 | { |
62 | 62 | $result = $this->object->delete(); |
63 | 63 | |
64 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
65 | - $this->assertNull( $result ); |
|
64 | + $this->assertNull($this->view->get('errors')); |
|
65 | + $this->assertNull($result); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testGet() |
70 | 70 | { |
71 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
72 | 72 | |
73 | - $this->view->item = $manager->findItem( 'CNC' ); |
|
73 | + $this->view->item = $manager->findItem('CNC'); |
|
74 | 74 | $result = $this->object->get(); |
75 | 75 | |
76 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
77 | - $this->assertContains( 'attribute-list', $result ); |
|
76 | + $this->assertNull($this->view->get('errors')); |
|
77 | + $this->assertContains('attribute-list', $result); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | 81 | public function testSave() |
82 | 82 | { |
83 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
84 | - $attrManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' ); |
|
83 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
84 | + $attrManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute'); |
|
85 | 85 | |
86 | - $item = $manager->findItem( 'CNC' ); |
|
87 | - $item->setCode( 'jqadm-test-characteristic' ); |
|
88 | - $item->setId( null ); |
|
86 | + $item = $manager->findItem('CNC'); |
|
87 | + $item->setCode('jqadm-test-characteristic'); |
|
88 | + $item->setId(null); |
|
89 | 89 | |
90 | - $manager->saveItem( $item ); |
|
90 | + $manager->saveItem($item); |
|
91 | 91 | |
92 | 92 | |
93 | 93 | $param = array( |
94 | 94 | 'characteristic' => array( |
95 | 95 | 'attribute' => array( |
96 | - 'product.lists.id' => array( '' ), |
|
97 | - 'product.lists.refid' => array( $attrManager->findItem( 'xs', array(), 'product', 'size' )->getId() ), |
|
96 | + 'product.lists.id' => array(''), |
|
97 | + 'product.lists.refid' => array($attrManager->findItem('xs', array(), 'product', 'size')->getId()), |
|
98 | 98 | ), |
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 | $this->view->item = $item; |
105 | 105 | |
106 | 106 | $result = $this->object->save(); |
107 | - $manager->deleteItem( $item->getId() ); |
|
107 | + $manager->deleteItem($item->getId()); |
|
108 | 108 | |
109 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
110 | - $this->assertNull( $result ); |
|
109 | + $this->assertNull($this->view->get('errors')); |
|
110 | + $this->assertNull($result); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
114 | 114 | public function testSearch() |
115 | 115 | { |
116 | - $this->assertNull( $this->object->search() ); |
|
116 | + $this->assertNull($this->object->search()); |
|
117 | 117 | } |
118 | 118 | } |
@@ -22,38 +22,38 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Characteristic\Property\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Characteristic\Property\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( 'Properties', $result ); |
|
44 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
43 | + $this->assertContains('Properties', $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( 'Properties', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('Properties', $result); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -61,70 +61,70 @@ discard block |
||
61 | 61 | { |
62 | 62 | $result = $this->object->delete(); |
63 | 63 | |
64 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
65 | - $this->assertNull( $result ); |
|
64 | + $this->assertNull($this->view->get('errors')); |
|
65 | + $this->assertNull($result); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testGet() |
70 | 70 | { |
71 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
72 | 72 | |
73 | - $this->view->item = $manager->findItem( 'CNC' ); |
|
73 | + $this->view->item = $manager->findItem('CNC'); |
|
74 | 74 | $result = $this->object->get(); |
75 | 75 | |
76 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
77 | - $this->assertContains( 'Properties', $result ); |
|
76 | + $this->assertNull($this->view->get('errors')); |
|
77 | + $this->assertContains('Properties', $result); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | 81 | public function testSave() |
82 | 82 | { |
83 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
84 | - $propManager = \Aimeos\MShop\Factory::createManager( $this->context, 'product/property' ); |
|
85 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'product/property/type' ); |
|
83 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
84 | + $propManager = \Aimeos\MShop\Factory::createManager($this->context, 'product/property'); |
|
85 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->context, 'product/property/type'); |
|
86 | 86 | |
87 | - $item = $manager->findItem( 'CNC' ); |
|
88 | - $item->setCode( 'jqadm-test-property' ); |
|
89 | - $item->setId( null ); |
|
87 | + $item = $manager->findItem('CNC'); |
|
88 | + $item->setCode('jqadm-test-property'); |
|
89 | + $item->setId(null); |
|
90 | 90 | |
91 | - $manager->saveItem( $item ); |
|
91 | + $manager->saveItem($item); |
|
92 | 92 | |
93 | 93 | |
94 | - $typeid = $typeManager->findItem( 'package-height', array(), 'product' )->getId(); |
|
94 | + $typeid = $typeManager->findItem('package-height', array(), 'product')->getId(); |
|
95 | 95 | |
96 | 96 | $param = array( |
97 | 97 | 'characteristic' => array( |
98 | 98 | 'property' => array( |
99 | - 'product.property.id' => array( '' ), |
|
100 | - 'product.property.typeid' => array( $typeid ), |
|
101 | - 'product.property.value' => array( '10.0' ), |
|
99 | + 'product.property.id' => array(''), |
|
100 | + 'product.property.typeid' => array($typeid), |
|
101 | + 'product.property.value' => array('10.0'), |
|
102 | 102 | ), |
103 | 103 | ), |
104 | 104 | ); |
105 | 105 | |
106 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
107 | - $this->view->addHelper( 'param', $helper ); |
|
106 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
107 | + $this->view->addHelper('param', $helper); |
|
108 | 108 | $this->view->item = $item; |
109 | 109 | |
110 | 110 | $result = $this->object->save(); |
111 | 111 | |
112 | 112 | $search = $propManager->createSearch(); |
113 | - $search->setConditions( $search->compare( '==', 'product.property.parentid', $item->getId() ) ); |
|
114 | - $items = $propManager->searchItems( $search ); |
|
113 | + $search->setConditions($search->compare('==', 'product.property.parentid', $item->getId())); |
|
114 | + $items = $propManager->searchItems($search); |
|
115 | 115 | |
116 | - $manager->deleteItem( $item->getId() ); |
|
116 | + $manager->deleteItem($item->getId()); |
|
117 | 117 | |
118 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
119 | - $this->assertNull( $result ); |
|
120 | - $this->assertEquals( 1, count( $items ) ); |
|
121 | - $this->assertEquals( null, reset( $items )->getLanguageId() ); |
|
122 | - $this->assertEquals( '10.0', reset( $items )->getValue() ); |
|
118 | + $this->assertNull($this->view->get('errors')); |
|
119 | + $this->assertNull($result); |
|
120 | + $this->assertEquals(1, count($items)); |
|
121 | + $this->assertEquals(null, reset($items)->getLanguageId()); |
|
122 | + $this->assertEquals('10.0', reset($items)->getValue()); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
126 | 126 | public function testSearch() |
127 | 127 | { |
128 | - $this->assertNull( $this->object->search() ); |
|
128 | + $this->assertNull($this->object->search()); |
|
129 | 129 | } |
130 | 130 | } |
@@ -22,38 +22,38 @@ discard block |
||
22 | 22 | $this->context = \TestHelperJqadm::getContext(); |
23 | 23 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
24 | 24 | |
25 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Price\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Price\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( 'Prices', $result ); |
|
44 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
43 | + $this->assertContains('Prices', $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( 'price' ) ); |
|
52 | + $this->view->item = $manager->findItem('CNC', array('price')); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'value="for 1 product"', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('value="for 1 product"', $result); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -61,82 +61,82 @@ discard block |
||
61 | 61 | { |
62 | 62 | $result = $this->object->delete(); |
63 | 63 | |
64 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
65 | - $this->assertNull( $result ); |
|
64 | + $this->assertNull($this->view->get('errors')); |
|
65 | + $this->assertNull($result); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testGet() |
70 | 70 | { |
71 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
72 | 72 | |
73 | - $this->view->item = $manager->findItem( 'CNC', array( 'price' ) ); |
|
73 | + $this->view->item = $manager->findItem('CNC', array('price')); |
|
74 | 74 | $result = $this->object->get(); |
75 | 75 | |
76 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
77 | - $this->assertContains( 'value="for 1 product"', $result ); |
|
76 | + $this->assertNull($this->view->get('errors')); |
|
77 | + $this->assertContains('value="for 1 product"', $result); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | 81 | public function testSave() |
82 | 82 | { |
83 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'price/type' ); |
|
84 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
83 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->context, 'price/type'); |
|
84 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
85 | 85 | |
86 | - $item = $manager->findItem( 'CNC' ); |
|
87 | - $item->setCode( 'jqadm-test-price' ); |
|
88 | - $item->setId( null ); |
|
86 | + $item = $manager->findItem('CNC'); |
|
87 | + $item->setCode('jqadm-test-price'); |
|
88 | + $item->setId(null); |
|
89 | 89 | |
90 | - $manager->saveItem( $item ); |
|
90 | + $manager->saveItem($item); |
|
91 | 91 | |
92 | 92 | |
93 | 93 | $param = array( |
94 | 94 | 'price' => array( |
95 | - 'product.lists.id' => array( '' ), |
|
96 | - 'price.typeid' => array( $typeManager->findItem( 'default', array(), 'product' )->getId() ), |
|
97 | - 'price.currencyid' => array( 'EUR' ), |
|
98 | - 'price.label' => array( 'test' ), |
|
99 | - 'price.quantity' => array( '2' ), |
|
100 | - 'price.value' => array( '10.00' ), |
|
101 | - 'price.costs' => array( '1.00' ), |
|
102 | - 'price.rebate' => array( '5.00' ), |
|
103 | - 'price.taxrate' => array( '20.00' ), |
|
95 | + 'product.lists.id' => array(''), |
|
96 | + 'price.typeid' => array($typeManager->findItem('default', array(), 'product')->getId()), |
|
97 | + 'price.currencyid' => array('EUR'), |
|
98 | + 'price.label' => array('test'), |
|
99 | + 'price.quantity' => array('2'), |
|
100 | + 'price.value' => array('10.00'), |
|
101 | + 'price.costs' => array('1.00'), |
|
102 | + 'price.rebate' => array('5.00'), |
|
103 | + 'price.taxrate' => array('20.00'), |
|
104 | 104 | ), |
105 | 105 | ); |
106 | 106 | |
107 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
108 | - $this->view->addHelper( 'param', $helper ); |
|
107 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
108 | + $this->view->addHelper('param', $helper); |
|
109 | 109 | $this->view->item = $item; |
110 | 110 | |
111 | 111 | $result = $this->object->save(); |
112 | 112 | |
113 | - $item = $manager->getItem( $item->getId(), array( 'price' ) ); |
|
114 | - $manager->deleteItem( $item->getId() ); |
|
113 | + $item = $manager->getItem($item->getId(), array('price')); |
|
114 | + $manager->deleteItem($item->getId()); |
|
115 | 115 | |
116 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
117 | - $this->assertNull( $result ); |
|
118 | - $this->assertEquals( 1, count( $item->getListItems() ) ); |
|
116 | + $this->assertNull($this->view->get('errors')); |
|
117 | + $this->assertNull($result); |
|
118 | + $this->assertEquals(1, count($item->getListItems())); |
|
119 | 119 | |
120 | - foreach( $item->getListItems( 'price' ) as $listItem ) |
|
120 | + foreach ($item->getListItems('price') as $listItem) |
|
121 | 121 | { |
122 | - $this->assertEquals( 'price', $listItem->getDomain() ); |
|
123 | - $this->assertEquals( 'default', $listItem->getType() ); |
|
122 | + $this->assertEquals('price', $listItem->getDomain()); |
|
123 | + $this->assertEquals('default', $listItem->getType()); |
|
124 | 124 | |
125 | 125 | $refItem = $listItem->getRefItem(); |
126 | - $this->assertEquals( 'default', $refItem->getType() ); |
|
127 | - $this->assertEquals( 'EUR', $refItem->getCurrencyId() ); |
|
128 | - $this->assertEquals( 'test', $refItem->getLabel() ); |
|
129 | - $this->assertEquals( '2', $refItem->getQuantity() ); |
|
130 | - $this->assertEquals( '10.00', $refItem->getValue() ); |
|
131 | - $this->assertEquals( '1.00', $refItem->getCosts() ); |
|
132 | - $this->assertEquals( '5.00', $refItem->getRebate() ); |
|
133 | - $this->assertEquals( '20.00', $refItem->getTaxRate() ); |
|
126 | + $this->assertEquals('default', $refItem->getType()); |
|
127 | + $this->assertEquals('EUR', $refItem->getCurrencyId()); |
|
128 | + $this->assertEquals('test', $refItem->getLabel()); |
|
129 | + $this->assertEquals('2', $refItem->getQuantity()); |
|
130 | + $this->assertEquals('10.00', $refItem->getValue()); |
|
131 | + $this->assertEquals('1.00', $refItem->getCosts()); |
|
132 | + $this->assertEquals('5.00', $refItem->getRebate()); |
|
133 | + $this->assertEquals('20.00', $refItem->getTaxRate()); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | 137 | |
138 | 138 | public function testSearch() |
139 | 139 | { |
140 | - $this->assertNull( $this->object->search() ); |
|
140 | + $this->assertNull($this->object->search()); |
|
141 | 141 | } |
142 | 142 | } |
@@ -19,48 +19,48 @@ discard block |
||
19 | 19 | protected function setUp() |
20 | 20 | { |
21 | 21 | $this->view = \TestHelperJqadm::getView(); |
22 | - $request = $this->getMock( '\Psr\Http\Message\ServerRequestInterface' ); |
|
23 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
24 | - $this->view ->addHelper( 'request', $helper ); |
|
22 | + $request = $this->getMock('\Psr\Http\Message\ServerRequestInterface'); |
|
23 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
24 | + $this->view ->addHelper('request', $helper); |
|
25 | 25 | |
26 | 26 | $this->context = \TestHelperJqadm::getContext(); |
27 | 27 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
28 | 28 | |
29 | - $this->object = $this->getMockBuilder( '\Aimeos\Admin\JQAdm\Product\Download\Standard' ) |
|
30 | - ->setConstructorArgs( array( $this->context, $templatePaths ) ) |
|
31 | - ->setMethods( array( 'storeFile' ) ) |
|
29 | + $this->object = $this->getMockBuilder('\Aimeos\Admin\JQAdm\Product\Download\Standard') |
|
30 | + ->setConstructorArgs(array($this->context, $templatePaths)) |
|
31 | + ->setMethods(array('storeFile')) |
|
32 | 32 | ->getMock(); |
33 | - $this->object->setView( $this->view ); |
|
33 | + $this->object->setView($this->view); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | protected function tearDown() |
38 | 38 | { |
39 | - unset( $this->object ); |
|
39 | + unset($this->object); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
43 | 43 | public function testCreate() |
44 | 44 | { |
45 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
45 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
46 | 46 | |
47 | 47 | $this->view->item = $manager->createItem(); |
48 | 48 | $result = $this->object->create(); |
49 | 49 | |
50 | - $this->assertContains( 'Download', $result ); |
|
51 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
50 | + $this->assertContains('Download', $result); |
|
51 | + $this->assertNull($this->view->get('errors')); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function testCopy() |
56 | 56 | { |
57 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
57 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
58 | 58 | |
59 | - $this->view->item = $manager->findItem( 'CNE', array( 'attribute' ) ); |
|
59 | + $this->view->item = $manager->findItem('CNE', array('attribute')); |
|
60 | 60 | $result = $this->object->copy(); |
61 | 61 | |
62 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
63 | - $this->assertContains( 'Test URL', $result ); |
|
62 | + $this->assertNull($this->view->get('errors')); |
|
63 | + $this->assertContains('Test URL', $result); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -68,32 +68,32 @@ discard block |
||
68 | 68 | { |
69 | 69 | $result = $this->object->delete(); |
70 | 70 | |
71 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
72 | - $this->assertNull( $result ); |
|
71 | + $this->assertNull($this->view->get('errors')); |
|
72 | + $this->assertNull($result); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | public function testGet() |
77 | 77 | { |
78 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
78 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
79 | 79 | |
80 | - $this->view->item = $manager->findItem( 'CNE', array( 'attribute' ) ); |
|
80 | + $this->view->item = $manager->findItem('CNE', array('attribute')); |
|
81 | 81 | $result = $this->object->get(); |
82 | 82 | |
83 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
84 | - $this->assertContains( 'Test URL', $result ); |
|
83 | + $this->assertNull($this->view->get('errors')); |
|
84 | + $this->assertContains('Test URL', $result); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
88 | 88 | public function testSave() |
89 | 89 | { |
90 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
90 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
91 | 91 | |
92 | - $item = $manager->findItem( 'CNE' ); |
|
93 | - $item->setCode( 'jqadm-test-download' ); |
|
94 | - $item->setId( null ); |
|
92 | + $item = $manager->findItem('CNE'); |
|
93 | + $item->setCode('jqadm-test-download'); |
|
94 | + $item->setId(null); |
|
95 | 95 | |
96 | - $manager->saveItem( $item ); |
|
96 | + $manager->saveItem($item); |
|
97 | 97 | |
98 | 98 | |
99 | 99 | $param = array( |
@@ -104,49 +104,49 @@ discard block |
||
104 | 104 | ), |
105 | 105 | ); |
106 | 106 | |
107 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
108 | - $this->view->addHelper( 'param', $helper ); |
|
107 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
108 | + $this->view->addHelper('param', $helper); |
|
109 | 109 | |
110 | - $file = $this->getMock( '\Psr\Http\Message\UploadedFileInterface' ); |
|
111 | - $file->expects( $this->any() )->method( 'getError' )->will( $this->returnValue( UPLOAD_ERR_OK ) ); |
|
110 | + $file = $this->getMock('\Psr\Http\Message\UploadedFileInterface'); |
|
111 | + $file->expects($this->any())->method('getError')->will($this->returnValue(UPLOAD_ERR_OK)); |
|
112 | 112 | |
113 | - $request = $this->getMock( '\Psr\Http\Message\ServerRequestInterface' ); |
|
114 | - $request->expects( $this->any() )->method( 'getUploadedFiles' ) |
|
115 | - ->will( $this->returnValue( array( 'download' => array( 'file' => $file ) ) ) ); |
|
113 | + $request = $this->getMock('\Psr\Http\Message\ServerRequestInterface'); |
|
114 | + $request->expects($this->any())->method('getUploadedFiles') |
|
115 | + ->will($this->returnValue(array('download' => array('file' => $file)))); |
|
116 | 116 | |
117 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request ); |
|
118 | - $this->view->addHelper( 'request', $helper ); |
|
117 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request); |
|
118 | + $this->view->addHelper('request', $helper); |
|
119 | 119 | |
120 | 120 | $this->view->item = $item; |
121 | 121 | |
122 | 122 | |
123 | - $this->object->expects( $this->once() )->method( 'storeFile' ) |
|
124 | - ->will( $this->returnValue( 'test/file.ext' ) ); |
|
123 | + $this->object->expects($this->once())->method('storeFile') |
|
124 | + ->will($this->returnValue('test/file.ext')); |
|
125 | 125 | |
126 | - $attributeStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Attribute\\Manager\\Standard' ) |
|
127 | - ->setConstructorArgs( array( $this->context ) ) |
|
128 | - ->setMethods( array( 'saveItem' ) ) |
|
126 | + $attributeStub = $this->getMockBuilder('\\Aimeos\\MShop\\Attribute\\Manager\\Standard') |
|
127 | + ->setConstructorArgs(array($this->context)) |
|
128 | + ->setMethods(array('saveItem')) |
|
129 | 129 | ->getMock(); |
130 | - $attributeStub->expects( $this->once() )->method( 'saveItem' ); |
|
131 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'attribute', $attributeStub ); |
|
130 | + $attributeStub->expects($this->once())->method('saveItem'); |
|
131 | + \Aimeos\MShop\Factory::injectManager($this->context, 'attribute', $attributeStub); |
|
132 | 132 | |
133 | 133 | |
134 | - \Aimeos\MShop\Factory::setCache( true ); |
|
134 | + \Aimeos\MShop\Factory::setCache(true); |
|
135 | 135 | $result = $this->object->save(); |
136 | - \Aimeos\MShop\Factory::setCache( false ); |
|
136 | + \Aimeos\MShop\Factory::setCache(false); |
|
137 | 137 | |
138 | 138 | |
139 | - $item = $manager->getItem( $item->getId(), array( 'attribute' ) ); |
|
140 | - $manager->deleteItem( $item->getId() ); |
|
139 | + $item = $manager->getItem($item->getId(), array('attribute')); |
|
140 | + $manager->deleteItem($item->getId()); |
|
141 | 141 | |
142 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
143 | - $this->assertNull( $result ); |
|
144 | - $this->assertEquals( 1, count( $item->getListItems( 'attribute', 'hidden' ) ) ); |
|
142 | + $this->assertNull($this->view->get('errors')); |
|
143 | + $this->assertNull($result); |
|
144 | + $this->assertEquals(1, count($item->getListItems('attribute', 'hidden'))); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
148 | 148 | public function testSearch() |
149 | 149 | { |
150 | - $this->assertNull( $this->object->search() ); |
|
150 | + $this->assertNull($this->object->search()); |
|
151 | 151 | } |
152 | 152 | } |
@@ -17,21 +17,21 @@ discard block |
||
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | 19 | $this->view = \TestHelperJqadm::getView(); |
20 | - $request = $this->getMock( '\Psr\Http\Message\ServerRequestInterface' ); |
|
21 | - $helper = new \Aimeos\MW\View\Helper\Request\Standard( $this->view, $request, '127.0.0.1', 'test' ); |
|
22 | - $this->view ->addHelper( 'request', $helper ); |
|
20 | + $request = $this->getMock('\Psr\Http\Message\ServerRequestInterface'); |
|
21 | + $helper = new \Aimeos\MW\View\Helper\Request\Standard($this->view, $request, '127.0.0.1', 'test'); |
|
22 | + $this->view ->addHelper('request', $helper); |
|
23 | 23 | |
24 | 24 | $this->context = \TestHelperJqadm::getContext(); |
25 | 25 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
26 | 26 | |
27 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Standard( $this->context, $templatePaths ); |
|
28 | - $this->object->setView( $this->view ); |
|
27 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Standard($this->context, $templatePaths); |
|
28 | + $this->object->setView($this->view); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | protected function tearDown() |
33 | 33 | { |
34 | - unset( $this->object ); |
|
34 | + unset($this->object); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -43,49 +43,49 @@ discard block |
||
43 | 43 | |
44 | 44 | public function testCopy() |
45 | 45 | { |
46 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
46 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
47 | 47 | |
48 | - $param = array( 'id' => $manager->findItem( 'CNC' )->getId() ); |
|
49 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
50 | - $this->view->addHelper( 'param', $helper ); |
|
48 | + $param = array('id' => $manager->findItem('CNC')->getId()); |
|
49 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
50 | + $this->view->addHelper('param', $helper); |
|
51 | 51 | |
52 | 52 | $result = $this->object->copy(); |
53 | 53 | |
54 | - $this->assertContains( 'CNC_copy', $result ); |
|
54 | + $this->assertContains('CNC_copy', $result); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
58 | 58 | public function testDelete() |
59 | 59 | { |
60 | - $this->assertNull( $this->object->delete() ); |
|
60 | + $this->assertNull($this->object->delete()); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | public function testGet() |
65 | 65 | { |
66 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
66 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
67 | 67 | |
68 | - $param = array( 'id' => $manager->findItem( 'CNC' )->getId() ); |
|
69 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
70 | - $this->view->addHelper( 'param', $helper ); |
|
68 | + $param = array('id' => $manager->findItem('CNC')->getId()); |
|
69 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
70 | + $this->view->addHelper('param', $helper); |
|
71 | 71 | |
72 | 72 | $result = $this->object->get(); |
73 | 73 | |
74 | - $this->assertContains( 'CNC', $result ); |
|
74 | + $this->assertContains('CNC', $result); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | 78 | public function testSave() |
79 | 79 | { |
80 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' ); |
|
81 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'product/type' ); |
|
80 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'product'); |
|
81 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->context, 'product/type'); |
|
82 | 82 | |
83 | 83 | $search = $typeManager->createSearch(); |
84 | - $search->setSlice( 0, 1 ); |
|
85 | - $typeItems = $typeManager->searchItems( $search ); |
|
84 | + $search->setSlice(0, 1); |
|
85 | + $typeItems = $typeManager->searchItems($search); |
|
86 | 86 | |
87 | - if( ( $typeItem = reset( $typeItems ) ) === false ) { |
|
88 | - throw new \Exception( 'No product type item found' ); |
|
87 | + if (($typeItem = reset($typeItems)) === false) { |
|
88 | + throw new \Exception('No product type item found'); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -98,28 +98,28 @@ discard block |
||
98 | 98 | 'product.datestart' => null, |
99 | 99 | 'product.dateend' => null, |
100 | 100 | 'config' => array( |
101 | - 'key' => array( 0 => 'test key' ), |
|
102 | - 'val' => array( 0 => 'test value' ), |
|
101 | + 'key' => array(0 => 'test key'), |
|
102 | + 'val' => array(0 => 'test value'), |
|
103 | 103 | ), |
104 | 104 | ), |
105 | 105 | ); |
106 | 106 | |
107 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
108 | - $this->view->addHelper( 'param', $helper ); |
|
107 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
108 | + $this->view->addHelper('param', $helper); |
|
109 | 109 | |
110 | 110 | $result = $this->object->save(); |
111 | 111 | |
112 | - $manager->deleteItem( $manager->findItem( 'test' )->getId() ); |
|
112 | + $manager->deleteItem($manager->findItem('test')->getId()); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
116 | 116 | public function testSearch() |
117 | 117 | { |
118 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, array( 'site' => 'unittest', 'lang' => 'de' ) ); |
|
119 | - $this->view->addHelper( 'param', $helper ); |
|
118 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, array('site' => 'unittest', 'lang' => 'de')); |
|
119 | + $this->view->addHelper('param', $helper); |
|
120 | 120 | |
121 | 121 | $result = $this->object->search(); |
122 | 122 | |
123 | - $this->assertContains( 'CNE', $result ); |
|
123 | + $this->assertContains('CNE', $result); |
|
124 | 124 | } |
125 | 125 | } |
@@ -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\Bundle\Standard( $this->context, $templatePaths ); |
|
26 | - $this->object->setView( $this->view ); |
|
25 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Bundle\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( 'Bundles', $result ); |
|
44 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
43 | + $this->assertContains('Bundles', $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( 'U:BUNDLE', array( 'product' ) ); |
|
52 | + $this->view->item = $manager->findItem('U:BUNDLE', array('product')); |
|
53 | 53 | $result = $this->object->copy(); |
54 | 54 | |
55 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
56 | - $this->assertContains( 'Cafe Noire Cappuccino', $result ); |
|
57 | - $this->assertContains( 'Cafe Noire Expresso', $result ); |
|
55 | + $this->assertNull($this->view->get('errors')); |
|
56 | + $this->assertContains('Cafe Noire Cappuccino', $result); |
|
57 | + $this->assertContains('Cafe Noire Expresso', $result); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -62,59 +62,59 @@ 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( 'U:BUNDLE', array( 'product' ) ); |
|
74 | + $this->view->item = $manager->findItem('U:BUNDLE', array('product')); |
|
75 | 75 | $result = $this->object->get(); |
76 | 76 | |
77 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
78 | - $this->assertContains( 'Cafe Noire Cappuccino', $result ); |
|
79 | - $this->assertContains( 'Cafe Noire Expresso', $result ); |
|
77 | + $this->assertNull($this->view->get('errors')); |
|
78 | + $this->assertContains('Cafe Noire Cappuccino', $result); |
|
79 | + $this->assertContains('Cafe Noire Expresso', $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( 'U:BUNDLE' ); |
|
88 | - $item->setCode( 'jqadm-test-bundle' ); |
|
89 | - $item->setId( null ); |
|
87 | + $item = $manager->findItem('U:BUNDLE'); |
|
88 | + $item->setCode('jqadm-test-bundle'); |
|
89 | + $item->setId(null); |
|
90 | 90 | |
91 | - $manager->saveItem( $item ); |
|
91 | + $manager->saveItem($item); |
|
92 | 92 | |
93 | 93 | |
94 | 94 | $param = array( |
95 | 95 | 'bundle' => array( |
96 | - 'product.lists.id' => array( '' ), |
|
97 | - 'product.lists.refid' => array( $manager->findItem( 'CNE' )->getId() ), |
|
96 | + 'product.lists.id' => array(''), |
|
97 | + 'product.lists.refid' => array($manager->findItem('CNE')->getId()), |
|
98 | 98 | ), |
99 | 99 | ); |
100 | 100 | |
101 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param ); |
|
102 | - $this->view->addHelper( 'param', $helper ); |
|
101 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param); |
|
102 | + $this->view->addHelper('param', $helper); |
|
103 | 103 | $this->view->item = $item; |
104 | 104 | |
105 | 105 | $result = $this->object->save(); |
106 | 106 | |
107 | - $item = $manager->getItem( $item->getId(), array( 'product' ) ); |
|
108 | - $manager->deleteItem( $item->getId() ); |
|
107 | + $item = $manager->getItem($item->getId(), array('product')); |
|
108 | + $manager->deleteItem($item->getId()); |
|
109 | 109 | |
110 | - $this->assertNull( $this->view->get( 'errors' ) ); |
|
111 | - $this->assertNull( $result ); |
|
112 | - $this->assertEquals( 1, count( $item->getListItems( 'product' ) ) ); |
|
110 | + $this->assertNull($this->view->get('errors')); |
|
111 | + $this->assertNull($result); |
|
112 | + $this->assertEquals(1, count($item->getListItems('product'))); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
116 | 116 | public function testSearch() |
117 | 117 | { |
118 | - $this->assertNull( $this->object->search() ); |
|
118 | + $this->assertNull($this->object->search()); |
|
119 | 119 | } |
120 | 120 | } |