@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | $context = \TestHelper::getContext(); |
21 | 21 | $this->editor = $context->getEditor(); |
22 | 22 | |
23 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::create( $context, 'Laravel' ); |
|
24 | - $this->object = $manager->getSubManager( 'property', 'Laravel' )->getSubManager( 'type', 'Laravel' ); |
|
23 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::create($context, 'Laravel'); |
|
24 | + $this->object = $manager->getSubManager('property', 'Laravel')->getSubManager('type', 'Laravel'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | |
34 | 34 | public function testCleanup() |
35 | 35 | { |
36 | - $this->object->cleanup( array( -1 ) ); |
|
36 | + $this->object->cleanup(array( -1 )); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | 40 | public function testCreateItem() |
41 | 41 | { |
42 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $this->object->createItem() ); |
|
42 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $this->object->createItem()); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | { |
48 | 48 | $result = $this->object->getResourceType(); |
49 | 49 | |
50 | - $this->assertContains( 'customer/property/type', $result ); |
|
50 | + $this->assertContains('customer/property/type', $result); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | public function testGetSearchAttributes() |
55 | 55 | { |
56 | - foreach( $this->object->getSearchAttributes() as $attribute ) { |
|
57 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
56 | + foreach ($this->object->getSearchAttributes() as $attribute) { |
|
57 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -63,82 +63,82 @@ discard block |
||
63 | 63 | { |
64 | 64 | $search = $this->object->createSearch(); |
65 | 65 | $conditions = array( |
66 | - $search->compare( '==', 'customer.property.type.code', 'newsletter' ), |
|
67 | - $search->compare( '==', 'customer.property.type.editor', $this->editor ) |
|
66 | + $search->compare('==', 'customer.property.type.code', 'newsletter'), |
|
67 | + $search->compare('==', 'customer.property.type.editor', $this->editor) |
|
68 | 68 | ); |
69 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
69 | + $search->setConditions($search->combine('&&', $conditions)); |
|
70 | 70 | |
71 | - $results = $this->object->searchItems( $search ); |
|
71 | + $results = $this->object->searchItems($search); |
|
72 | 72 | |
73 | - if( ($expected = reset($results) ) === false ) |
|
73 | + if (($expected = reset($results)) === false) |
|
74 | 74 | { |
75 | - throw new \RuntimeException( 'No property type item found.' ); |
|
75 | + throw new \RuntimeException('No property type item found.'); |
|
76 | 76 | } |
77 | 77 | |
78 | - $actual = $this->object->getItem( $expected->getId() ); |
|
78 | + $actual = $this->object->getItem($expected->getId()); |
|
79 | 79 | |
80 | - $this->assertEquals( $expected, $actual ); |
|
80 | + $this->assertEquals($expected, $actual); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | 84 | public function testSaveInvalid() |
85 | 85 | { |
86 | - $this->setExpectedException( \Aimeos\MW\Common\Exception::class ); |
|
87 | - $this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() ); |
|
86 | + $this->setExpectedException(\Aimeos\MW\Common\Exception::class); |
|
87 | + $this->object->saveItem(new \Aimeos\MShop\Locale\Item\Standard()); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | 91 | public function testSaveUpdateDeleteItem() |
92 | 92 | { |
93 | 93 | $search = $this->object->createSearch(); |
94 | - $search->setConditions( $search->compare( '==', 'customer.property.type.editor', $this->editor ) ); |
|
94 | + $search->setConditions($search->compare('==', 'customer.property.type.editor', $this->editor)); |
|
95 | 95 | $results = $this->object->searchItems($search); |
96 | 96 | |
97 | - if( ( $item = reset($results) ) === false ) { |
|
98 | - throw new \RuntimeException( 'No type item found' ); |
|
97 | + if (($item = reset($results)) === false) { |
|
98 | + throw new \RuntimeException('No type item found'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $item->setId(null); |
102 | - $item->setCode( 'unitTestSave' ); |
|
103 | - $resultSaved = $this->object->saveItem( $item ); |
|
104 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
102 | + $item->setCode('unitTestSave'); |
|
103 | + $resultSaved = $this->object->saveItem($item); |
|
104 | + $itemSaved = $this->object->getItem($item->getId()); |
|
105 | 105 | |
106 | 106 | $itemExp = clone $itemSaved; |
107 | - $itemExp->setCode( 'unitTestSave2' ); |
|
108 | - $resultUpd = $this->object->saveItem( $itemExp ); |
|
109 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
107 | + $itemExp->setCode('unitTestSave2'); |
|
108 | + $resultUpd = $this->object->saveItem($itemExp); |
|
109 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
110 | 110 | |
111 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
111 | + $this->object->deleteItem($itemSaved->getId()); |
|
112 | 112 | |
113 | 113 | |
114 | - $this->assertTrue( $item->getId() !== null ); |
|
115 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
116 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
117 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
118 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
119 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
120 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
114 | + $this->assertTrue($item->getId() !== null); |
|
115 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
116 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
117 | + $this->assertEquals($item->getCode(), $itemSaved->getCode()); |
|
118 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
119 | + $this->assertEquals($item->getLabel(), $itemSaved->getLabel()); |
|
120 | + $this->assertEquals($item->getStatus(), $itemSaved->getStatus()); |
|
121 | 121 | |
122 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
123 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
124 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
122 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
123 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
124 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
125 | 125 | |
126 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
127 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
128 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
129 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
130 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
131 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
126 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
127 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
128 | + $this->assertEquals($itemExp->getCode(), $itemUpd->getCode()); |
|
129 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
130 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
131 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
132 | 132 | |
133 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
134 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
135 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
133 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
134 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
135 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
136 | 136 | |
137 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultSaved ); |
|
138 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultUpd ); |
|
137 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultSaved); |
|
138 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultUpd); |
|
139 | 139 | |
140 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
141 | - $this->object->getItem( $itemSaved->getId() ); |
|
140 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
141 | + $this->object->getItem($itemSaved->getId()); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -148,36 +148,36 @@ discard block |
||
148 | 148 | $search = $this->object->createSearch(); |
149 | 149 | |
150 | 150 | $expr = []; |
151 | - $expr[] = $search->compare( '!=', 'customer.property.type.id', null ); |
|
152 | - $expr[] = $search->compare( '!=', 'customer.property.type.siteid', null ); |
|
153 | - $expr[] = $search->compare( '==', 'customer.property.type.domain', 'customer' ); |
|
154 | - $expr[] = $search->compare( '==', 'customer.property.type.code', 'newsletter' ); |
|
155 | - $expr[] = $search->compare( '>', 'customer.property.type.label', '' ); |
|
156 | - $expr[] = $search->compare( '>=', 'customer.property.type.position', 0 ); |
|
157 | - $expr[] = $search->compare( '==', 'customer.property.type.status', 1 ); |
|
158 | - $expr[] = $search->compare( '>=', 'customer.property.type.mtime', '1970-01-01 00:00:00' ); |
|
159 | - $expr[] = $search->compare( '>=', 'customer.property.type.ctime', '1970-01-01 00:00:00' ); |
|
160 | - $expr[] = $search->compare( '==', 'customer.property.type.editor', $this->editor ); |
|
161 | - |
|
162 | - $search->setConditions( $search->combine('&&', $expr) ); |
|
163 | - $results = $this->object->searchItems( $search, [], $total ); |
|
164 | - $this->assertEquals( 1, count( $results ) ); |
|
151 | + $expr[] = $search->compare('!=', 'customer.property.type.id', null); |
|
152 | + $expr[] = $search->compare('!=', 'customer.property.type.siteid', null); |
|
153 | + $expr[] = $search->compare('==', 'customer.property.type.domain', 'customer'); |
|
154 | + $expr[] = $search->compare('==', 'customer.property.type.code', 'newsletter'); |
|
155 | + $expr[] = $search->compare('>', 'customer.property.type.label', ''); |
|
156 | + $expr[] = $search->compare('>=', 'customer.property.type.position', 0); |
|
157 | + $expr[] = $search->compare('==', 'customer.property.type.status', 1); |
|
158 | + $expr[] = $search->compare('>=', 'customer.property.type.mtime', '1970-01-01 00:00:00'); |
|
159 | + $expr[] = $search->compare('>=', 'customer.property.type.ctime', '1970-01-01 00:00:00'); |
|
160 | + $expr[] = $search->compare('==', 'customer.property.type.editor', $this->editor); |
|
161 | + |
|
162 | + $search->setConditions($search->combine('&&', $expr)); |
|
163 | + $results = $this->object->searchItems($search, [], $total); |
|
164 | + $this->assertEquals(1, count($results)); |
|
165 | 165 | |
166 | 166 | |
167 | 167 | $search = $this->object->createSearch(); |
168 | 168 | $conditions = array( |
169 | - $search->compare( '=~', 'customer.property.type.code', 'newsletter'), |
|
170 | - $search->compare( '==', 'customer.property.type.editor', $this->editor ) |
|
169 | + $search->compare('=~', 'customer.property.type.code', 'newsletter'), |
|
170 | + $search->compare('==', 'customer.property.type.editor', $this->editor) |
|
171 | 171 | ); |
172 | - $search->setConditions( $search->combine('&&', $conditions ) ); |
|
172 | + $search->setConditions($search->combine('&&', $conditions)); |
|
173 | 173 | $search->setSlice(0, 1); |
174 | - $items = $this->object->searchItems( $search, [], $total); |
|
174 | + $items = $this->object->searchItems($search, [], $total); |
|
175 | 175 | |
176 | - $this->assertEquals( 1, count( $items ) ); |
|
177 | - $this->assertEquals( 1, $total ); |
|
176 | + $this->assertEquals(1, count($items)); |
|
177 | + $this->assertEquals(1, $total); |
|
178 | 178 | |
179 | - foreach($items as $itemId => $item) { |
|
180 | - $this->assertEquals( $itemId, $item->getId() ); |
|
179 | + foreach ($items as $itemId => $item) { |
|
180 | + $this->assertEquals($itemId, $item->getId()); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 |