Completed
Push — master ( 3a0c6f...c1f25f )
by Aimeos
01:50
created
lib/custom/tests/MShop/Customer/Manager/Property/LaravelTest.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -20,89 +20,89 @@  discard block
 block discarded – undo
20 20
 		$context = \TestHelper::getContext();
21 21
 		$this->editor = $context->getEditor();
22 22
 
23
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'Laravel' );
24
-		$this->object = $manager->getSubManager( 'property', 'Laravel' );
23
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context, 'Laravel');
24
+		$this->object = $manager->getSubManager('property', 'Laravel');
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		unset( $this->object );
30
+		unset($this->object);
31 31
 	}
32 32
 
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 42
 		$item = $this->object->createItem();
43
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item );
43
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item);
44 44
 	}
45 45
 
46 46
 
47 47
 	public function testSaveInvalid()
48 48
 	{
49
-		$this->setExpectedException( \Aimeos\MW\Common\Exception::class );
50
-		$this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() );
49
+		$this->setExpectedException(\Aimeos\MW\Common\Exception::class);
50
+		$this->object->saveItem(new \Aimeos\MShop\Locale\Item\Standard());
51 51
 	}
52 52
 
53 53
 
54 54
 	public function testSaveUpdateDeleteItem()
55 55
 	{
56 56
 		$search = $this->object->createSearch();
57
-		$search->setConditions( $search->compare( '==', 'customer.property.editor', $this->editor ) );
58
-		$results = $this->object->searchItems( $search );
57
+		$search->setConditions($search->compare('==', 'customer.property.editor', $this->editor));
58
+		$results = $this->object->searchItems($search);
59 59
 
60
-		if( ( $item = reset($results) ) === false ) {
61
-			throw new \RuntimeException( 'No property item found' );
60
+		if (($item = reset($results)) === false) {
61
+			throw new \RuntimeException('No property item found');
62 62
 		}
63 63
 
64 64
 		$item->setId(null);
65
-		$item->setLanguageId( 'en' );
66
-		$resultSaved = $this->object->saveItem( $item );
67
-		$itemSaved = $this->object->getItem( $item->getId() );
65
+		$item->setLanguageId('en');
66
+		$resultSaved = $this->object->saveItem($item);
67
+		$itemSaved = $this->object->getItem($item->getId());
68 68
 
69 69
 		$itemExp = clone $itemSaved;
70
-		$itemExp->setValue( 'unittest' );
71
-		$resultUpd = $this->object->saveItem( $itemExp );
72
-		$itemUpd = $this->object->getItem( $itemExp->getId() );
70
+		$itemExp->setValue('unittest');
71
+		$resultUpd = $this->object->saveItem($itemExp);
72
+		$itemUpd = $this->object->getItem($itemExp->getId());
73 73
 
74
-		$this->object->deleteItem( $itemSaved->getId() );
74
+		$this->object->deleteItem($itemSaved->getId());
75 75
 
76 76
 		$context = \TestHelper::getContext();
77 77
 
78
-		$this->assertTrue( $item->getId() !== null );
79
-		$this->assertEquals( $item->getId(), $itemSaved->getId() );
80
-		$this->assertEquals( $item->getParentId(), $itemSaved->getParentId() );
81
-		$this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() );
82
-		$this->assertEquals( $item->getType(), $itemSaved->getType() );
83
-		$this->assertEquals( $item->getLanguageId(), $itemSaved->getLanguageId() );
84
-		$this->assertEquals( $item->getValue(), $itemSaved->getValue() );
85
-
86
-		$this->assertEquals( $context->getEditor(), $itemSaved->getEditor() );
87
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() );
88
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() );
89
-
90
-		$this->assertEquals( $itemExp->getId(), $itemUpd->getId() );
91
-		$this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() );
92
-		$this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() );
93
-		$this->assertEquals( $itemExp->getType(), $itemUpd->getType() );
94
-		$this->assertEquals( $itemExp->getLanguageId(), $itemUpd->getLanguageId() );
95
-		$this->assertEquals( $itemExp->getValue(), $itemUpd->getValue() );
96
-
97
-		$this->assertEquals( $context->getEditor(), $itemUpd->getEditor() );
98
-		$this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() );
99
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() );
100
-
101
-		$this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultSaved );
102
-		$this->assertInstanceOf( \Aimeos\MShop\Common\Item\Iface::class, $resultUpd );
103
-
104
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
105
-		$this->object->getItem( $itemSaved->getId() );
78
+		$this->assertTrue($item->getId() !== null);
79
+		$this->assertEquals($item->getId(), $itemSaved->getId());
80
+		$this->assertEquals($item->getParentId(), $itemSaved->getParentId());
81
+		$this->assertEquals($item->getSiteId(), $itemSaved->getSiteId());
82
+		$this->assertEquals($item->getType(), $itemSaved->getType());
83
+		$this->assertEquals($item->getLanguageId(), $itemSaved->getLanguageId());
84
+		$this->assertEquals($item->getValue(), $itemSaved->getValue());
85
+
86
+		$this->assertEquals($context->getEditor(), $itemSaved->getEditor());
87
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated());
88
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified());
89
+
90
+		$this->assertEquals($itemExp->getId(), $itemUpd->getId());
91
+		$this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId());
92
+		$this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId());
93
+		$this->assertEquals($itemExp->getType(), $itemUpd->getType());
94
+		$this->assertEquals($itemExp->getLanguageId(), $itemUpd->getLanguageId());
95
+		$this->assertEquals($itemExp->getValue(), $itemUpd->getValue());
96
+
97
+		$this->assertEquals($context->getEditor(), $itemUpd->getEditor());
98
+		$this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated());
99
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified());
100
+
101
+		$this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultSaved);
102
+		$this->assertInstanceOf(\Aimeos\MShop\Common\Item\Iface::class, $resultUpd);
103
+
104
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
105
+		$this->object->getItem($itemSaved->getId());
106 106
 	}
107 107
 
108 108
 
@@ -110,18 +110,18 @@  discard block
 block discarded – undo
110 110
 	{
111 111
 		$search = $this->object->createSearch();
112 112
 		$conditions = array(
113
-			$search->compare( '~=', 'customer.property.value', '1'),
114
-			$search->compare( '==', 'customer.property.editor', $this->editor )
113
+			$search->compare('~=', 'customer.property.value', '1'),
114
+			$search->compare('==', 'customer.property.editor', $this->editor)
115 115
 		);
116
-		$search->setConditions( $search->combine( '&&', $conditions ) );
117
-		$results = $this->object->searchItems( $search );
116
+		$search->setConditions($search->combine('&&', $conditions));
117
+		$results = $this->object->searchItems($search);
118 118
 
119
-		if( ($expected = reset($results)) === false ) {
120
-			throw new \RuntimeException( sprintf( 'No customer property item found for value "%1$s".', '1' ) );
119
+		if (($expected = reset($results)) === false) {
120
+			throw new \RuntimeException(sprintf('No customer property item found for value "%1$s".', '1'));
121 121
 		}
122 122
 
123
-		$actual = $this->object->getItem( $expected->getId() );
124
-		$this->assertEquals( $expected, $actual );
123
+		$actual = $this->object->getItem($expected->getId());
124
+		$this->assertEquals($expected, $actual);
125 125
 	}
126 126
 
127 127
 
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 	{
130 130
 		$result = $this->object->getResourceType();
131 131
 
132
-		$this->assertContains( 'customer/property', $result );
132
+		$this->assertContains('customer/property', $result);
133 133
 	}
134 134
 
135 135
 
136 136
 	public function testGetSearchAttributes()
137 137
 	{
138
-		foreach( $this->object->getSearchAttributes() as $attribute ) {
139
-			$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute );
138
+		foreach ($this->object->getSearchAttributes() as $attribute) {
139
+			$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute);
140 140
 		}
141 141
 	}
142 142
 
@@ -147,24 +147,24 @@  discard block
 block discarded – undo
147 147
 		$search = $this->object->createSearch();
148 148
 
149 149
 		$expr = [];
150
-		$expr[] = $search->compare( '!=', 'customer.property.id', null );
151
-		$expr[] = $search->compare( '!=', 'customer.property.parentid', null );
152
-		$expr[] = $search->compare( '!=', 'customer.property.siteid', null );
153
-		$expr[] = $search->compare( '==', 'customer.property.type', 'newsletter' );
154
-		$expr[] = $search->compare( '==', 'customer.property.languageid', null );
155
-		$expr[] = $search->compare( '==', 'customer.property.value', '1' );
156
-		$expr[] = $search->compare( '==', 'customer.property.editor', $this->editor );
157
-
158
-		$search->setConditions( $search->combine('&&', $expr) );
159
-		$results = $this->object->searchItems( $search, [], $total );
160
-		$this->assertEquals( 1, count( $results ) );
150
+		$expr[] = $search->compare('!=', 'customer.property.id', null);
151
+		$expr[] = $search->compare('!=', 'customer.property.parentid', null);
152
+		$expr[] = $search->compare('!=', 'customer.property.siteid', null);
153
+		$expr[] = $search->compare('==', 'customer.property.type', 'newsletter');
154
+		$expr[] = $search->compare('==', 'customer.property.languageid', null);
155
+		$expr[] = $search->compare('==', 'customer.property.value', '1');
156
+		$expr[] = $search->compare('==', 'customer.property.editor', $this->editor);
157
+
158
+		$search->setConditions($search->combine('&&', $expr));
159
+		$results = $this->object->searchItems($search, [], $total);
160
+		$this->assertEquals(1, count($results));
161 161
 	}
162 162
 
163 163
 
164 164
 	public function testGetSubManager()
165 165
 	{
166
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') );
167
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') );
166
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type'));
167
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard'));
168 168
 
169 169
 		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
170 170
 		$this->object->getSubManager('unknown');
Please login to merge, or discard this patch.