@@ -4,17 +4,17 @@ |
||
4 | 4 | * Set error reporting to maximum |
5 | 5 | */ |
6 | 6 | error_reporting( -1 ); |
7 | -ini_set( 'display_errors', true ); |
|
7 | +ini_set('display_errors', true); |
|
8 | 8 | |
9 | -date_default_timezone_set( 'UTC' ); |
|
9 | +date_default_timezone_set('UTC'); |
|
10 | 10 | |
11 | 11 | /* |
12 | 12 | * Set locale settings to reasonable defaults |
13 | 13 | */ |
14 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
15 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
16 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
17 | -setlocale( LC_TIME, 'POSIX' ); |
|
14 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
15 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
16 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
17 | +setlocale(LC_TIME, 'POSIX'); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | require_once 'TestHelper.php'; |
@@ -16,44 +16,44 @@ |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - $customer = new \Aimeos\MShop\Customer\Manager\Ezpublish( \TestHelper::getContext() ); |
|
19 | + $customer = new \Aimeos\MShop\Customer\Manager\Ezpublish(\TestHelper::getContext()); |
|
20 | 20 | |
21 | - $this->object = $customer->getSubManager( 'address', 'Ezpublish' ); |
|
21 | + $this->object = $customer->getSubManager('address', 'Ezpublish'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | protected function tearDown() |
26 | 26 | { |
27 | - unset( $this->object ); |
|
27 | + unset($this->object); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testCleanup() |
32 | 32 | { |
33 | - $this->object->cleanup( array( -1 ) ); |
|
33 | + $this->object->cleanup(array( -1 )); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function testDeleteItems() |
38 | 38 | { |
39 | - $this->object->deleteItems( array( -1 ) ); |
|
39 | + $this->object->deleteItems(array( -1 )); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
43 | 43 | public function testGetSearchAttributes() |
44 | 44 | { |
45 | 45 | $attributes = $this->object->getSearchAttributes(); |
46 | - $this->assertGreaterThan( 0, count( $attributes ) ); |
|
46 | + $this->assertGreaterThan(0, count($attributes)); |
|
47 | 47 | |
48 | - foreach( $attributes as $attribute ) { |
|
49 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
48 | + foreach ($attributes as $attribute) { |
|
49 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | public function testGetSubManager() |
55 | 55 | { |
56 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
57 | - $this->object->getSubManager( 'unknown' ); |
|
56 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
57 | + $this->object->getSubManager('unknown'); |
|
58 | 58 | } |
59 | 59 | } |
@@ -39,9 +39,9 @@ |
||
39 | 39 | * @param string $value password of the customer item |
40 | 40 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls |
41 | 41 | */ |
42 | - public function setPassword( $value ) |
|
42 | + public function setPassword($value) |
|
43 | 43 | { |
44 | - if( $value !== '' && $value != $this->getPassword() ) |
|
44 | + if ($value !== '' && $value != $this->getPassword()) |
|
45 | 45 | { |
46 | 46 | $this->password = (string) $value; |
47 | 47 | $this->setModified(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param \eZ\Publish\API\Repository\UserService $service eZ user service object |
29 | 29 | * @return \Aimeos\MShop\Context\Item\Iface Context item for chaining method calls |
30 | 30 | */ |
31 | - public function setEzUserService( \eZ\Publish\API\Repository\UserService $service ) |
|
31 | + public function setEzUserService(\eZ\Publish\API\Repository\UserService $service) |
|
32 | 32 | { |
33 | 33 | $this->ezUserService = $service; |
34 | 34 | return $this; |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getEzUserService() |
44 | 44 | { |
45 | - if( !isset( $this->ezUserService ) ) { |
|
46 | - throw new \Aimeos\MShop\Exception( sprintf( 'eZ user service not available' ) ); |
|
45 | + if (!isset($this->ezUserService)) { |
|
46 | + throw new \Aimeos\MShop\Exception(sprintf('eZ user service not available')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | return $this->ezUserService; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function getPreDependencies() |
23 | 23 | { |
24 | - return array( 'TablesCreateEzpublish' ); |
|
24 | + return array('TablesCreateEzpublish'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -41,29 +41,29 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function migrate() |
43 | 43 | { |
44 | - $this->msg( 'Adding address fields to ezuser table', 0 ); |
|
44 | + $this->msg('Adding address fields to ezuser table', 0); |
|
45 | 45 | |
46 | - $dbal = $this->getConnection( 'db-customer' )->getRawObject(); |
|
46 | + $dbal = $this->getConnection('db-customer')->getRawObject(); |
|
47 | 47 | |
48 | - if( !( $dbal instanceof \Doctrine\DBAL\Connection ) ) { |
|
49 | - throw new \Aimeos\MW\Setup\Exception( 'Not a DBAL connection' ); |
|
48 | + if (!($dbal instanceof \Doctrine\DBAL\Connection)) { |
|
49 | + throw new \Aimeos\MW\Setup\Exception('Not a DBAL connection'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | $fromSchema = $dbal->getSchemaManager()->createSchema(); |
54 | 54 | $toSchema = clone $fromSchema; |
55 | 55 | |
56 | - $this->addIndexes( $this->addColumns( $toSchema->getTable( 'ezuser' ) ) ); |
|
57 | - $sql = $fromSchema->getMigrateToSql( $toSchema, $dbal->getDatabasePlatform() ); |
|
56 | + $this->addIndexes($this->addColumns($toSchema->getTable('ezuser'))); |
|
57 | + $sql = $fromSchema->getMigrateToSql($toSchema, $dbal->getDatabasePlatform()); |
|
58 | 58 | |
59 | - if( $sql !== [] ) |
|
59 | + if ($sql !== []) |
|
60 | 60 | { |
61 | - $this->executeList( $sql, 'db-customer' ); |
|
62 | - $this->status( 'done' ); |
|
61 | + $this->executeList($sql, 'db-customer'); |
|
62 | + $this->status('done'); |
|
63 | 63 | } |
64 | 64 | else |
65 | 65 | { |
66 | - $this->status( 'OK' ); |
|
66 | + $this->status('OK'); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -74,38 +74,38 @@ discard block |
||
74 | 74 | * @param \Doctrine\DBAL\Schema\Table $table Table object |
75 | 75 | * @return \Doctrine\DBAL\Schema\Table Updated table object |
76 | 76 | */ |
77 | - protected function addColumns( \Doctrine\DBAL\Schema\Table $table ) |
|
77 | + protected function addColumns(\Doctrine\DBAL\Schema\Table $table) |
|
78 | 78 | { |
79 | 79 | $columns = array( |
80 | - 'company' => array( 'string', array( 'length' => 100 ) ), |
|
81 | - 'vatid' => array( 'string', array( 'length' => 32 ) ), |
|
82 | - 'salutation' => array( 'string', array( 'length' => 8 ) ), |
|
83 | - 'title' => array( 'string', array( 'length' => 64 ) ), |
|
84 | - 'firstname' => array( 'string', array( 'length' => 64 ) ), |
|
85 | - 'lastname' => array( 'string', array( 'length' => 64 ) ), |
|
86 | - 'address1' => array( 'string', array( 'length' => 255 ) ), |
|
87 | - 'address2' => array( 'string', array( 'length' => 255 ) ), |
|
88 | - 'address3' => array( 'string', array( 'length' => 255 ) ), |
|
89 | - 'postal' => array( 'string', array( 'length' => 16 ) ), |
|
90 | - 'city' => array( 'string', array( 'length' => 255 ) ), |
|
91 | - 'state' => array( 'string', array( 'length' => 255 ) ), |
|
92 | - 'langid' => array( 'string', array( 'length' => 5, 'notnull' => false ) ), |
|
93 | - 'countryid' => array( 'string', array( 'length' => 2, 'notnull' => false, 'fixed' => true ) ), |
|
94 | - 'telephone' => array( 'string', array( 'length' => 32 ) ), |
|
95 | - 'telefax' => array( 'string', array( 'length' => 32 ) ), |
|
96 | - 'website' => array( 'string', array( 'length' => 255 ) ), |
|
97 | - 'birthday' => array( 'date', array( 'notnull' => false ) ), |
|
98 | - 'vdate' => array( 'date', array( 'notnull' => false ) ), |
|
99 | - 'status' => array( 'smallint', [] ), |
|
100 | - 'mtime' => array( 'datetime', [] ), |
|
101 | - 'ctime' => array( 'datetime', [] ), |
|
102 | - 'editor' => array( 'string', array( 'length' => 255 ) ), |
|
80 | + 'company' => array('string', array('length' => 100)), |
|
81 | + 'vatid' => array('string', array('length' => 32)), |
|
82 | + 'salutation' => array('string', array('length' => 8)), |
|
83 | + 'title' => array('string', array('length' => 64)), |
|
84 | + 'firstname' => array('string', array('length' => 64)), |
|
85 | + 'lastname' => array('string', array('length' => 64)), |
|
86 | + 'address1' => array('string', array('length' => 255)), |
|
87 | + 'address2' => array('string', array('length' => 255)), |
|
88 | + 'address3' => array('string', array('length' => 255)), |
|
89 | + 'postal' => array('string', array('length' => 16)), |
|
90 | + 'city' => array('string', array('length' => 255)), |
|
91 | + 'state' => array('string', array('length' => 255)), |
|
92 | + 'langid' => array('string', array('length' => 5, 'notnull' => false)), |
|
93 | + 'countryid' => array('string', array('length' => 2, 'notnull' => false, 'fixed' => true)), |
|
94 | + 'telephone' => array('string', array('length' => 32)), |
|
95 | + 'telefax' => array('string', array('length' => 32)), |
|
96 | + 'website' => array('string', array('length' => 255)), |
|
97 | + 'birthday' => array('date', array('notnull' => false)), |
|
98 | + 'vdate' => array('date', array('notnull' => false)), |
|
99 | + 'status' => array('smallint', []), |
|
100 | + 'mtime' => array('datetime', []), |
|
101 | + 'ctime' => array('datetime', []), |
|
102 | + 'editor' => array('string', array('length' => 255)), |
|
103 | 103 | ); |
104 | 104 | |
105 | - foreach( $columns as $name => $def ) |
|
105 | + foreach ($columns as $name => $def) |
|
106 | 106 | { |
107 | - if( $table->hasColumn( $name ) === false ) { |
|
108 | - $table->addColumn( $name, $def[0], $def[1] ); |
|
107 | + if ($table->hasColumn($name) === false) { |
|
108 | + $table->addColumn($name, $def[0], $def[1]); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -119,23 +119,23 @@ discard block |
||
119 | 119 | * @param \Doctrine\DBAL\Schema\Table $table Table object |
120 | 120 | * @return \Doctrine\DBAL\Schema\Table Updated table object |
121 | 121 | */ |
122 | - protected function addIndexes( \Doctrine\DBAL\Schema\Table $table ) |
|
122 | + protected function addIndexes(\Doctrine\DBAL\Schema\Table $table) |
|
123 | 123 | { |
124 | 124 | $indexes = array( |
125 | - 'idx_ezpus_langid' => array( 'langid' ), |
|
126 | - 'idx_ezpus_status_ln_fn' => array( 'status', 'lastname', 'firstname' ), |
|
127 | - 'idx_ezpus_status_ad1_ad2' => array( 'status', 'address1', 'address2' ), |
|
128 | - 'idx_ezpus_status_postal_city' => array( 'status', 'postal', 'city' ), |
|
129 | - 'idx_ezpus_lastname' => array( 'lastname' ), |
|
130 | - 'idx_ezpus_address1' => array( 'address1' ), |
|
131 | - 'idx_ezpus_postal' => array( 'postal' ), |
|
132 | - 'idx_ezpus_city' => array( 'city' ), |
|
125 | + 'idx_ezpus_langid' => array('langid'), |
|
126 | + 'idx_ezpus_status_ln_fn' => array('status', 'lastname', 'firstname'), |
|
127 | + 'idx_ezpus_status_ad1_ad2' => array('status', 'address1', 'address2'), |
|
128 | + 'idx_ezpus_status_postal_city' => array('status', 'postal', 'city'), |
|
129 | + 'idx_ezpus_lastname' => array('lastname'), |
|
130 | + 'idx_ezpus_address1' => array('address1'), |
|
131 | + 'idx_ezpus_postal' => array('postal'), |
|
132 | + 'idx_ezpus_city' => array('city'), |
|
133 | 133 | ); |
134 | 134 | |
135 | - foreach( $indexes as $name => $def ) |
|
135 | + foreach ($indexes as $name => $def) |
|
136 | 136 | { |
137 | - if( $table->hasIndex( $name ) === false ) { |
|
138 | - $table->addIndex( $def, $name ); |
|
137 | + if ($table->hasIndex($name) === false) { |
|
138 | + $table->addIndex($def, $name); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param integer[] $siteids List of IDs for sites whose entries should be deleted |
74 | 74 | */ |
75 | - public function cleanup( array $siteids ) |
|
75 | + public function cleanup(array $siteids) |
|
76 | 76 | { |
77 | 77 | } |
78 | 78 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param array $ids List of IDs |
84 | 84 | */ |
85 | - public function deleteItems( array $ids ) |
|
85 | + public function deleteItems(array $ids) |
|
86 | 86 | { |
87 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Deleting groups is not supported, please use the eZ Publish backend' ) ); |
|
87 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Deleting groups is not supported, please use the eZ Publish backend')); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | * @param boolean $withsub Return also attributes of sub-managers if true |
95 | 95 | * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface |
96 | 96 | */ |
97 | - public function getSearchAttributes( $withsub = true ) |
|
97 | + public function getSearchAttributes($withsub = true) |
|
98 | 98 | { |
99 | 99 | $path = 'mshop/customer/manager/group/submanagers'; |
100 | 100 | |
101 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
|
101 | + return $this->getSearchAttributesBase($this->searchConfig, $path, [], $withsub); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
110 | 110 | * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions |
111 | 111 | */ |
112 | - public function getSubManager( $manager, $name = null ) |
|
112 | + public function getSubManager($manager, $name = null) |
|
113 | 113 | { |
114 | - return $this->getSubManagerBase( 'customer/group', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
114 | + return $this->getSubManagerBase('customer/group', $manager, ($name === null ? 'Ezpublish' : $name)); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | * @param \Aimeos\MShop\Customer\Item\Group\Iface $item Customer group item |
122 | 122 | * @param boolean $fetch True if the new ID should be returned in the item |
123 | 123 | */ |
124 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
124 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
125 | 125 | { |
126 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Saving groups is not supported, please use the eZ Publish backend' ) ); |
|
126 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Saving groups is not supported, please use the eZ Publish backend')); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -136,33 +136,33 @@ discard block |
||
136 | 136 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Group\Iface |
137 | 137 | * @throws \Aimeos\MShop\Exception If retrieving items failed |
138 | 138 | */ |
139 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
|
139 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null) |
|
140 | 140 | { |
141 | 141 | $map = []; |
142 | 142 | $context = $this->getContext(); |
143 | 143 | |
144 | 144 | $dbm = $context->getDatabaseManager(); |
145 | 145 | $dbname = $this->getResourceName(); |
146 | - $conn = $dbm->acquire( $dbname ); |
|
146 | + $conn = $dbm->acquire($dbname); |
|
147 | 147 | |
148 | 148 | try |
149 | 149 | { |
150 | - $required = array( 'customer.group' ); |
|
150 | + $required = array('customer.group'); |
|
151 | 151 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
152 | 152 | $cfgPathSearch = 'mshop/customer/manager/group/ezpublish/search'; |
153 | 153 | $cfgPathCount = 'mshop/customer/manager/group/ezpublish/count'; |
154 | 154 | |
155 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
155 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
156 | 156 | |
157 | - while( ( $row = $results->fetch() ) !== false ) { |
|
158 | - $map[$row['customer.group.id']] = $this->createItemBase( $row ); |
|
157 | + while (($row = $results->fetch()) !== false) { |
|
158 | + $map[$row['customer.group.id']] = $this->createItemBase($row); |
|
159 | 159 | } |
160 | 160 | |
161 | - $dbm->release( $conn, $dbname ); |
|
161 | + $dbm->release($conn, $dbname); |
|
162 | 162 | } |
163 | - catch( \Exception $e ) |
|
163 | + catch (\Exception $e) |
|
164 | 164 | { |
165 | - $dbm->release( $conn, $dbname ); |
|
165 | + $dbm->release($conn, $dbname); |
|
166 | 166 | throw $e; |
167 | 167 | } |
168 | 168 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'label' => 'Customer address ID', |
27 | 27 | 'code' => 'customer.address.id', |
28 | 28 | 'internalcode' => 'ezuad."id"', |
29 | - 'internaldeps' => array( 'LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )' ), |
|
29 | + 'internaldeps' => array('LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )'), |
|
30 | 30 | 'type' => 'integer', |
31 | 31 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
32 | 32 | 'public' => false, |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @param array $siteids List of IDs for sites whose entries should be deleted |
211 | 211 | */ |
212 | - public function cleanup( array $siteids ) |
|
212 | + public function cleanup(array $siteids) |
|
213 | 213 | { |
214 | 214 | $path = 'mshop/customer/manager/address/submanagers'; |
215 | - foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) { |
|
216 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
215 | + foreach ($this->getContext()->getConfig()->get($path, []) as $domain) { |
|
216 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
217 | 217 | } |
218 | 218 | |
219 | - $this->cleanupBase( $siteids, 'mshop/customer/manager/lists/ezpublish/delete' ); |
|
219 | + $this->cleanupBase($siteids, 'mshop/customer/manager/lists/ezpublish/delete'); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | * @param boolean $withsub Return also attributes of sub-managers if true |
227 | 227 | * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface |
228 | 228 | */ |
229 | - public function getSearchAttributes( $withsub = true ) |
|
229 | + public function getSearchAttributes($withsub = true) |
|
230 | 230 | { |
231 | 231 | $path = 'mshop/customer/manager/address/submanagers'; |
232 | 232 | |
233 | - return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, [], $withsub ); |
|
233 | + return $this->getSearchAttributesBase($this->getSearchConfig(), $path, [], $withsub); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
242 | 242 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
243 | 243 | */ |
244 | - public function getSubManager( $manager, $name = null ) |
|
244 | + public function getSubManager($manager, $name = null) |
|
245 | 245 | { |
246 | - return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
246 | + return $this->getSubManagerBase('customer', 'address/'.$manager, ($name === null ? 'Ezpublish' : $name)); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 |
@@ -18,206 +18,206 @@ |
||
18 | 18 | |
19 | 19 | protected function setUp() |
20 | 20 | { |
21 | - if( !interface_exists( 'eZ\Publish\API\Repository\UserService' ) ) { |
|
22 | - $this->markTestSkipped( 'Install ezsystems/ezpublish-api first' ); |
|
21 | + if (!interface_exists('eZ\Publish\API\Repository\UserService')) { |
|
22 | + $this->markTestSkipped('Install ezsystems/ezpublish-api first'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $this->context = \TestHelper::getContext(); |
26 | 26 | |
27 | - $this->object = new \Aimeos\MShop\Customer\Manager\Ezpublish( $this->context ); |
|
28 | - $this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.' ); |
|
27 | + $this->object = new \Aimeos\MShop\Customer\Manager\Ezpublish($this->context); |
|
28 | + $this->address = new \Aimeos\MShop\Common\Item\Address\Standard('common.address.'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | protected function tearDown() |
33 | 33 | { |
34 | - unset( $this->object, $this->context, $this->address ); |
|
34 | + unset($this->object, $this->context, $this->address); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testCleanup() |
39 | 39 | { |
40 | - $this->object->cleanup( array( -1 ) ); |
|
40 | + $this->object->cleanup(array( -1 )); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testCreateItem() |
45 | 45 | { |
46 | - $this->assertInstanceOf( 'Aimeos\MShop\Customer\Item\Iface', $this->object->createItem() ); |
|
46 | + $this->assertInstanceOf('Aimeos\MShop\Customer\Item\Iface', $this->object->createItem()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testDeleteItems() |
51 | 51 | { |
52 | - $mock = $this->getMockBuilder( 'eZ\Publish\API\Repository\UserService' )->getMock(); |
|
53 | - $user = $this->getMockBuilder( 'eZ\Publish\API\Repository\Values\User\User' )->getMock(); |
|
52 | + $mock = $this->getMockBuilder('eZ\Publish\API\Repository\UserService')->getMock(); |
|
53 | + $user = $this->getMockBuilder('eZ\Publish\API\Repository\Values\User\User')->getMock(); |
|
54 | 54 | |
55 | - $mock->expects( $this->once() )->method( 'loadUser' )->will( $this->returnValue( $user ) ); |
|
56 | - $mock->expects( $this->once() )->method( 'deleteUser' ); |
|
55 | + $mock->expects($this->once())->method('loadUser')->will($this->returnValue($user)); |
|
56 | + $mock->expects($this->once())->method('deleteUser'); |
|
57 | 57 | |
58 | - $this->context->setEzUserService( $mock ); |
|
59 | - $this->object->deleteItems( array( -1 ) ); |
|
58 | + $this->context->setEzUserService($mock); |
|
59 | + $this->object->deleteItems(array( -1 )); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | public function testGetSearchAttributes() |
64 | 64 | { |
65 | 65 | $attributes = $this->object->getSearchAttributes(); |
66 | - $this->assertGreaterThan( 0, count( $attributes ) ); |
|
66 | + $this->assertGreaterThan(0, count($attributes)); |
|
67 | 67 | |
68 | - foreach( $attributes as $attribute ) { |
|
69 | - $this->assertInstanceOf( \Aimeos\MW\Criteria\Attribute\Iface::class, $attribute ); |
|
68 | + foreach ($attributes as $attribute) { |
|
69 | + $this->assertInstanceOf(\Aimeos\MW\Criteria\Attribute\Iface::class, $attribute); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | 74 | public function testGetSubManager() |
75 | 75 | { |
76 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'address' ) ); |
|
77 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'address', 'Standard' ) ); |
|
76 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('address')); |
|
77 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('address', 'Standard')); |
|
78 | 78 | |
79 | - $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
|
80 | - $this->object->getSubManager( 'unknown' ); |
|
79 | + $this->setExpectedException(\Aimeos\MShop\Exception::class); |
|
80 | + $this->object->getSubManager('unknown'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | 84 | public function testGetSubManagerInvalidName() |
85 | 85 | { |
86 | - $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
|
87 | - $this->object->getSubManager( 'address', 'unknown' ); |
|
86 | + $this->setExpectedException(\Aimeos\MShop\Exception::class); |
|
87 | + $this->object->getSubManager('address', 'unknown'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | 91 | public function testSaveItemInsert() |
92 | 92 | { |
93 | - $service = $this->getMockBuilder( 'eZ\Publish\API\Repository\UserService' )->getMock(); |
|
94 | - $struct = $this->getMockBuilder( 'eZ\Publish\API\Repository\Values\User\UserCreateStruct' )->getMock(); |
|
95 | - $user = $this->getMockBuilder( \eZ\Publish\API\Repository\Values\User\User::class ) |
|
96 | - ->setMethods( array( 'getUserId', 'getVersionInfo', 'getFieldValue', 'getFields', 'getFieldsByLanguage' ) ) |
|
93 | + $service = $this->getMockBuilder('eZ\Publish\API\Repository\UserService')->getMock(); |
|
94 | + $struct = $this->getMockBuilder('eZ\Publish\API\Repository\Values\User\UserCreateStruct')->getMock(); |
|
95 | + $user = $this->getMockBuilder(\eZ\Publish\API\Repository\Values\User\User::class) |
|
96 | + ->setMethods(array('getUserId', 'getVersionInfo', 'getFieldValue', 'getFields', 'getFieldsByLanguage')) |
|
97 | 97 | ->getMock(); |
98 | 98 | |
99 | - $dbm = $this->getMockBuilder( 'Aimeos\MW\DB\Manager\Iface' )->getMock(); |
|
100 | - $conn = $this->getMockBuilder( 'Aimeos\MW\DB\Connection\Iface' )->getMock(); |
|
101 | - $stmt = $this->getMockBuilder( 'Aimeos\MW\DB\Statement\Iface' )->getMock(); |
|
102 | - $result = $this->getMockBuilder( 'Aimeos\MW\DB\Result\Iface' )->getMock(); |
|
99 | + $dbm = $this->getMockBuilder('Aimeos\MW\DB\Manager\Iface')->getMock(); |
|
100 | + $conn = $this->getMockBuilder('Aimeos\MW\DB\Connection\Iface')->getMock(); |
|
101 | + $stmt = $this->getMockBuilder('Aimeos\MW\DB\Statement\Iface')->getMock(); |
|
102 | + $result = $this->getMockBuilder('Aimeos\MW\DB\Result\Iface')->getMock(); |
|
103 | 103 | |
104 | - $service->expects( $this->once() )->method( 'newUserCreateStruct' )->will( $this->returnValue( $struct ) ); |
|
105 | - $service->expects( $this->once() )->method( 'createUser' )->will( $this->returnValue( $user ) ); |
|
106 | - $user->expects( $this->once() )->method( 'getUserId' )->will( $this->returnValue( 1 ) ); |
|
107 | - $dbm->expects( $this->once() )->method( 'acquire' )->will( $this->returnValue( $conn ) ); |
|
108 | - $conn->expects( $this->once() )->method( 'create' )->will( $this->returnValue( $stmt ) ); |
|
109 | - $stmt->expects( $this->once() )->method( 'execute' )->will( $this->returnValue( $result ) ); |
|
104 | + $service->expects($this->once())->method('newUserCreateStruct')->will($this->returnValue($struct)); |
|
105 | + $service->expects($this->once())->method('createUser')->will($this->returnValue($user)); |
|
106 | + $user->expects($this->once())->method('getUserId')->will($this->returnValue(1)); |
|
107 | + $dbm->expects($this->once())->method('acquire')->will($this->returnValue($conn)); |
|
108 | + $conn->expects($this->once())->method('create')->will($this->returnValue($stmt)); |
|
109 | + $stmt->expects($this->once())->method('execute')->will($this->returnValue($result)); |
|
110 | 110 | |
111 | 111 | |
112 | - $this->context->setDatabaseManager( $dbm ); |
|
113 | - $this->context->setEzUserService( $service ); |
|
112 | + $this->context->setDatabaseManager($dbm); |
|
113 | + $this->context->setEzUserService($service); |
|
114 | 114 | |
115 | - $this->object->saveItem( new \Aimeos\MShop\Customer\Item\Standard( $this->address ) ); |
|
115 | + $this->object->saveItem(new \Aimeos\MShop\Customer\Item\Standard($this->address)); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
119 | 119 | public function testSaveItemUpdate() |
120 | 120 | { |
121 | - $service = $this->getMockBuilder( 'eZ\Publish\API\Repository\UserService' )->getMock(); |
|
122 | - $user = $this->getMockBuilder( 'eZ\Publish\API\Repository\Values\User\User' )->getMock(); |
|
123 | - $struct = $this->getMockBuilder( 'eZ\Publish\API\Repository\Values\User\UserUpdateStruct' )->getMock(); |
|
124 | - $dbm = $this->getMockBuilder( 'Aimeos\MW\DB\Manager\Iface' )->getMock(); |
|
125 | - $conn = $this->getMockBuilder( 'Aimeos\MW\DB\Connection\Iface' )->getMock(); |
|
126 | - $stmt = $this->getMockBuilder( 'Aimeos\MW\DB\Statement\Iface' )->getMock(); |
|
127 | - $result = $this->getMockBuilder( 'Aimeos\MW\DB\Result\Iface' )->getMock(); |
|
128 | - |
|
129 | - $service->expects( $this->once() )->method( 'updateUser' ); |
|
130 | - $service->expects( $this->once() )->method( 'loadUser' )->will( $this->returnValue( $user ) ); |
|
131 | - $service->expects( $this->once() )->method( 'newUserUpdateStruct' )->will( $this->returnValue( $struct ) ); |
|
132 | - $dbm->expects( $this->once() )->method( 'acquire' )->will( $this->returnValue( $conn ) ); |
|
133 | - $conn->expects( $this->once() )->method( 'create' )->will( $this->returnValue( $stmt ) ); |
|
134 | - $stmt->expects( $this->once() )->method( 'execute' )->will( $this->returnValue( $result ) ); |
|
135 | - $result->expects( $this->once() )->method( 'finish' ); |
|
136 | - $dbm->expects( $this->once() )->method( 'release' ); |
|
137 | - |
|
138 | - |
|
139 | - $item = new \Aimeos\MShop\Customer\Item\Standard( $this->address, array( 'customer.id' => 1 ) ); |
|
140 | - $item->setStatus( 1 ); |
|
141 | - |
|
142 | - $this->context->setDatabaseManager( $dbm ); |
|
143 | - $this->context->setEzUserService( $service ); |
|
144 | - $this->object->saveItem( $item ); |
|
121 | + $service = $this->getMockBuilder('eZ\Publish\API\Repository\UserService')->getMock(); |
|
122 | + $user = $this->getMockBuilder('eZ\Publish\API\Repository\Values\User\User')->getMock(); |
|
123 | + $struct = $this->getMockBuilder('eZ\Publish\API\Repository\Values\User\UserUpdateStruct')->getMock(); |
|
124 | + $dbm = $this->getMockBuilder('Aimeos\MW\DB\Manager\Iface')->getMock(); |
|
125 | + $conn = $this->getMockBuilder('Aimeos\MW\DB\Connection\Iface')->getMock(); |
|
126 | + $stmt = $this->getMockBuilder('Aimeos\MW\DB\Statement\Iface')->getMock(); |
|
127 | + $result = $this->getMockBuilder('Aimeos\MW\DB\Result\Iface')->getMock(); |
|
128 | + |
|
129 | + $service->expects($this->once())->method('updateUser'); |
|
130 | + $service->expects($this->once())->method('loadUser')->will($this->returnValue($user)); |
|
131 | + $service->expects($this->once())->method('newUserUpdateStruct')->will($this->returnValue($struct)); |
|
132 | + $dbm->expects($this->once())->method('acquire')->will($this->returnValue($conn)); |
|
133 | + $conn->expects($this->once())->method('create')->will($this->returnValue($stmt)); |
|
134 | + $stmt->expects($this->once())->method('execute')->will($this->returnValue($result)); |
|
135 | + $result->expects($this->once())->method('finish'); |
|
136 | + $dbm->expects($this->once())->method('release'); |
|
137 | + |
|
138 | + |
|
139 | + $item = new \Aimeos\MShop\Customer\Item\Standard($this->address, array('customer.id' => 1)); |
|
140 | + $item->setStatus(1); |
|
141 | + |
|
142 | + $this->context->setDatabaseManager($dbm); |
|
143 | + $this->context->setEzUserService($service); |
|
144 | + $this->object->saveItem($item); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
148 | 148 | public function testSaveItemInvalidItem() |
149 | 149 | { |
150 | - $this->setExpectedException( \Aimeos\MW\Common\Exception::class ); |
|
151 | - $this->object->saveItem( new \Aimeos\MShop\Common\Item\Lists\Standard( 'common.lists.' ) ); |
|
150 | + $this->setExpectedException(\Aimeos\MW\Common\Exception::class); |
|
151 | + $this->object->saveItem(new \Aimeos\MShop\Common\Item\Lists\Standard('common.lists.')); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | 155 | public function testSaveItemNotModified() |
156 | 156 | { |
157 | - $item = new \Aimeos\MShop\Customer\Item\Standard( $this->address, array( 'customer.id' => 1 ) ); |
|
158 | - $this->object->saveItem( $item ); |
|
157 | + $item = new \Aimeos\MShop\Customer\Item\Standard($this->address, array('customer.id' => 1)); |
|
158 | + $this->object->saveItem($item); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | 162 | public function testSaveItemInvalidContext() |
163 | 163 | { |
164 | 164 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
165 | - $context->setConfig( $this->context->getConfig() ); |
|
165 | + $context->setConfig($this->context->getConfig()); |
|
166 | 166 | |
167 | - $object = new \Aimeos\MShop\Customer\Manager\Ezpublish( $context ); |
|
167 | + $object = new \Aimeos\MShop\Customer\Manager\Ezpublish($context); |
|
168 | 168 | |
169 | - $this->setExpectedException( \Aimeos\MShop\Customer\Exception::class ); |
|
170 | - $object->saveItem( new \Aimeos\MShop\Customer\Item\Standard( $this->address ) ); |
|
169 | + $this->setExpectedException(\Aimeos\MShop\Customer\Exception::class); |
|
170 | + $object->saveItem(new \Aimeos\MShop\Customer\Item\Standard($this->address)); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
174 | 174 | public function testSearchItems() |
175 | 175 | { |
176 | - $mock = $this->getMockBuilder( \Aimeos\MShop\Customer\Manager\Ezpublish::class ) |
|
177 | - ->setConstructorArgs( array( $this->context ) ) |
|
178 | - ->setMethods( array( 'searchItemsBase' ) ) |
|
176 | + $mock = $this->getMockBuilder(\Aimeos\MShop\Customer\Manager\Ezpublish::class) |
|
177 | + ->setConstructorArgs(array($this->context)) |
|
178 | + ->setMethods(array('searchItemsBase')) |
|
179 | 179 | ->getMock(); |
180 | 180 | |
181 | - $result1 = $this->getMockBuilder( \Aimeos\MW\DB\Result\Iface::class )->getMock(); |
|
181 | + $result1 = $this->getMockBuilder(\Aimeos\MW\DB\Result\Iface::class)->getMock(); |
|
182 | 182 | |
183 | - $mock->expects( $this->once() )->method( 'searchItemsBase' )->will( $this->returnValue( $result1 ) ); |
|
184 | - $result1->expects( $this->exactly( 2 ) )->method( 'fetch' ) |
|
185 | - ->will( $this->onConsecutiveCalls( array( 'customer.id' => -1 ), false ) ); |
|
183 | + $mock->expects($this->once())->method('searchItemsBase')->will($this->returnValue($result1)); |
|
184 | + $result1->expects($this->exactly(2))->method('fetch') |
|
185 | + ->will($this->onConsecutiveCalls(array('customer.id' => -1), false)); |
|
186 | 186 | |
187 | 187 | |
188 | - $dbm = $this->getMockBuilder( 'Aimeos\MW\DB\Manager\Iface' )->getMock(); |
|
189 | - $conn = $this->getMockBuilder( 'Aimeos\MW\DB\Connection\Iface' )->getMock(); |
|
190 | - $stmt = $this->getMockBuilder( 'Aimeos\MW\DB\Statement\Iface' )->getMock(); |
|
191 | - $result2 = $this->getMockBuilder( \Aimeos\MW\DB\Result\Iface::class )->getMock(); |
|
188 | + $dbm = $this->getMockBuilder('Aimeos\MW\DB\Manager\Iface')->getMock(); |
|
189 | + $conn = $this->getMockBuilder('Aimeos\MW\DB\Connection\Iface')->getMock(); |
|
190 | + $stmt = $this->getMockBuilder('Aimeos\MW\DB\Statement\Iface')->getMock(); |
|
191 | + $result2 = $this->getMockBuilder(\Aimeos\MW\DB\Result\Iface::class)->getMock(); |
|
192 | 192 | |
193 | - $dbm->expects( $this->any() )->method( 'acquire' )->will( $this->returnValue( $conn ) ); |
|
194 | - $conn->expects( $this->once() )->method( 'create' )->will( $this->returnValue( $stmt ) ); |
|
195 | - $stmt->expects( $this->once() )->method( 'execute' )->will( $this->returnValue( $result2 ) ); |
|
196 | - $result2->expects( $this->exactly( 2 ) )->method( 'fetch' ) |
|
197 | - ->will( $this->onConsecutiveCalls( array( 'contentobject_id' => -1, 'role_id' => -2 ), false ) ); |
|
193 | + $dbm->expects($this->any())->method('acquire')->will($this->returnValue($conn)); |
|
194 | + $conn->expects($this->once())->method('create')->will($this->returnValue($stmt)); |
|
195 | + $stmt->expects($this->once())->method('execute')->will($this->returnValue($result2)); |
|
196 | + $result2->expects($this->exactly(2))->method('fetch') |
|
197 | + ->will($this->onConsecutiveCalls(array('contentobject_id' => -1, 'role_id' => -2), false)); |
|
198 | 198 | |
199 | - $dbm->expects( $this->any() )->method( 'release' ); |
|
199 | + $dbm->expects($this->any())->method('release'); |
|
200 | 200 | |
201 | 201 | |
202 | - $this->context->setDatabaseManager( $dbm ); |
|
203 | - $list = $mock->searchItems( $mock->createSearch() ); |
|
202 | + $this->context->setDatabaseManager($dbm); |
|
203 | + $list = $mock->searchItems($mock->createSearch()); |
|
204 | 204 | |
205 | - $this->assertEquals( 1, count( $list ) ); |
|
206 | - $this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Iface::class, $list[-1] ); |
|
205 | + $this->assertEquals(1, count($list)); |
|
206 | + $this->assertInstanceOf(\Aimeos\MShop\Customer\Item\Iface::class, $list[-1]); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
210 | 210 | public function testSearchItemsException() |
211 | 211 | { |
212 | - $object = $this->getMockBuilder( \Aimeos\MShop\Customer\Manager\Ezpublish::class ) |
|
213 | - ->setConstructorArgs( array( $this->context ) ) |
|
214 | - ->setMethods( array( 'searchItemsBase' ) ) |
|
212 | + $object = $this->getMockBuilder(\Aimeos\MShop\Customer\Manager\Ezpublish::class) |
|
213 | + ->setConstructorArgs(array($this->context)) |
|
214 | + ->setMethods(array('searchItemsBase')) |
|
215 | 215 | ->getMock(); |
216 | 216 | |
217 | - $object->expects( $this->once() )->method( 'searchItemsBase' ) |
|
218 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
217 | + $object->expects($this->once())->method('searchItemsBase') |
|
218 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
219 | 219 | |
220 | - $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
|
221 | - $object->searchItems( $object->createSearch() ); |
|
220 | + $this->setExpectedException(\Aimeos\MShop\Exception::class); |
|
221 | + $object->searchItems($object->createSearch()); |
|
222 | 222 | } |
223 | 223 | } |
@@ -18,91 +18,91 @@ |
||
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | 20 | $this->context = \TestHelper::getContext(); |
21 | - $customer = new \Aimeos\MShop\Customer\Manager\Ezpublish( $this->context ); |
|
21 | + $customer = new \Aimeos\MShop\Customer\Manager\Ezpublish($this->context); |
|
22 | 22 | |
23 | - $this->object = $customer->getSubManager( 'group', 'Ezpublish' ); |
|
23 | + $this->object = $customer->getSubManager('group', 'Ezpublish'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | protected function tearDown() |
28 | 28 | { |
29 | - unset( $this->object ); |
|
29 | + unset($this->object); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | public function testCleanup() |
34 | 34 | { |
35 | - $this->object->cleanup( array( -1 ) ); |
|
35 | + $this->object->cleanup(array( -1 )); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testDeleteItems() |
40 | 40 | { |
41 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
42 | - $this->object->deleteItems( array( -1 ) ); |
|
41 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
42 | + $this->object->deleteItems(array( -1 )); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | public function testGetSearchAttributes() |
47 | 47 | { |
48 | 48 | $attributes = $this->object->getSearchAttributes(); |
49 | - $this->assertGreaterThan( 0, count( $attributes ) ); |
|
49 | + $this->assertGreaterThan(0, count($attributes)); |
|
50 | 50 | |
51 | - foreach( $attributes as $attribute ) { |
|
52 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
51 | + foreach ($attributes as $attribute) { |
|
52 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | public function testGetSubManager() |
58 | 58 | { |
59 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
60 | - $this->object->getSubManager( 'unknown' ); |
|
59 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
60 | + $this->object->getSubManager('unknown'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | public function testSaveItem() |
65 | 65 | { |
66 | - $this->setExpectedException( '\\Aimeos\\MShop\\Customer\\Exception' ); |
|
67 | - $this->object->saveItem( new \Aimeos\MShop\Common\Item\Lists\Standard( 'common.lists.' ) ); |
|
66 | + $this->setExpectedException('\\Aimeos\\MShop\\Customer\\Exception'); |
|
67 | + $this->object->saveItem(new \Aimeos\MShop\Common\Item\Lists\Standard('common.lists.')); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
71 | 71 | public function testSearchItems() |
72 | 72 | { |
73 | - $mock = $this->getMockBuilder( \Aimeos\MShop\Customer\Manager\Group\Ezpublish::class ) |
|
74 | - ->setConstructorArgs( array( \TestHelper::getContext() ) ) |
|
75 | - ->setMethods( array( 'searchItemsBase' ) ) |
|
73 | + $mock = $this->getMockBuilder(\Aimeos\MShop\Customer\Manager\Group\Ezpublish::class) |
|
74 | + ->setConstructorArgs(array(\TestHelper::getContext())) |
|
75 | + ->setMethods(array('searchItemsBase')) |
|
76 | 76 | ->getMock(); |
77 | 77 | |
78 | - $result = $this->getMockBuilder( \Aimeos\MW\DB\Result\Iface::class ) |
|
79 | - ->setMethods( array( 'affectedRows', 'fetch', 'finish', 'nextResult' ) ) |
|
78 | + $result = $this->getMockBuilder(\Aimeos\MW\DB\Result\Iface::class) |
|
79 | + ->setMethods(array('affectedRows', 'fetch', 'finish', 'nextResult')) |
|
80 | 80 | ->getMock(); |
81 | 81 | |
82 | - $mock->expects( $this->once() )->method( 'searchItemsBase' ) |
|
83 | - ->will( $this->returnValue( $result ) ); |
|
82 | + $mock->expects($this->once())->method('searchItemsBase') |
|
83 | + ->will($this->returnValue($result)); |
|
84 | 84 | |
85 | - $result->expects( $this->exactly( 2 ) )->method( 'fetch' ) |
|
86 | - ->will( $this->onConsecutiveCalls( array( 'customer.group.id' => 1 ), false ) ); |
|
85 | + $result->expects($this->exactly(2))->method('fetch') |
|
86 | + ->will($this->onConsecutiveCalls(array('customer.group.id' => 1), false)); |
|
87 | 87 | |
88 | - $result = $mock->searchItems( $mock->createSearch() ); |
|
88 | + $result = $mock->searchItems($mock->createSearch()); |
|
89 | 89 | |
90 | - $this->assertEquals( 1, count( $result ) ); |
|
91 | - $this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Group\Iface::class, $result[1] ); |
|
90 | + $this->assertEquals(1, count($result)); |
|
91 | + $this->assertInstanceOf(\Aimeos\MShop\Customer\Item\Group\Iface::class, $result[1]); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
95 | 95 | public function testSearchItemsException() |
96 | 96 | { |
97 | - $mock = $this->getMockBuilder( \Aimeos\MShop\Customer\Manager\Group\Ezpublish::class ) |
|
98 | - ->setConstructorArgs( array( \TestHelper::getContext() ) ) |
|
99 | - ->setMethods( array( 'searchItemsBase' ) ) |
|
97 | + $mock = $this->getMockBuilder(\Aimeos\MShop\Customer\Manager\Group\Ezpublish::class) |
|
98 | + ->setConstructorArgs(array(\TestHelper::getContext())) |
|
99 | + ->setMethods(array('searchItemsBase')) |
|
100 | 100 | ->getMock(); |
101 | 101 | |
102 | - $mock->expects( $this->once() )->method( 'searchItemsBase' ) |
|
103 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
102 | + $mock->expects($this->once())->method('searchItemsBase') |
|
103 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
104 | 104 | |
105 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
106 | - $mock->searchItems( $mock->createSearch() ); |
|
105 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
106 | + $mock->searchItems($mock->createSearch()); |
|
107 | 107 | } |
108 | 108 | } |