@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | - 'name' => 'ai-ezpublish', |
|
| 5 | - 'depends' => array( |
|
| 6 | - 'aimeos-core', |
|
| 7 | - ), |
|
| 8 | - 'include' => array( |
|
| 9 | - 'lib/custom/src', |
|
| 10 | - ), |
|
| 11 | - 'config' => array( |
|
| 12 | - 'lib/custom/config', |
|
| 13 | - ), |
|
| 14 | - 'setup' => array( |
|
| 15 | - 'lib/custom/setup', |
|
| 16 | - ), |
|
| 4 | + 'name' => 'ai-ezpublish', |
|
| 5 | + 'depends' => array( |
|
| 6 | + 'aimeos-core', |
|
| 7 | + ), |
|
| 8 | + 'include' => array( |
|
| 9 | + 'lib/custom/src', |
|
| 10 | + ), |
|
| 11 | + 'config' => array( |
|
| 12 | + 'lib/custom/config', |
|
| 13 | + ), |
|
| 14 | + 'setup' => array( |
|
| 15 | + 'lib/custom/setup', |
|
| 16 | + ), |
|
| 17 | 17 | ); |
@@ -6,14 +6,14 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'delete' => array( |
|
| 10 | - 'ansi' => ' |
|
| 9 | + 'delete' => array( |
|
| 10 | + 'ansi' => ' |
|
| 11 | 11 | DELETE FROM "ezuser" |
| 12 | 12 | WHERE :cond |
| 13 | 13 | ', |
| 14 | - ), |
|
| 15 | - 'update' => array( |
|
| 16 | - 'ansi' => ' |
|
| 14 | + ), |
|
| 15 | + 'update' => array( |
|
| 16 | + 'ansi' => ' |
|
| 17 | 17 | UPDATE "ezuser" |
| 18 | 18 | SET "login_normalized" = ?, "login" = ?, "company" = ?, "vatid" = ?, |
| 19 | 19 | "salutation" = ?, "title" = ?, "firstname" = ?, "lastname" = ?, |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | "mtime" = ?, "editor" = ?, "ctime" = ? |
| 25 | 25 | WHERE "contentobject_id" = ? |
| 26 | 26 | ', |
| 27 | - ), |
|
| 28 | - 'search' => array( |
|
| 29 | - 'ansi' => ' |
|
| 27 | + ), |
|
| 28 | + 'search' => array( |
|
| 29 | + 'ansi' => ' |
|
| 30 | 30 | SELECT DISTINCT ezu."contentobject_id" AS "customer.id", |
| 31 | 31 | ezu."login_normalized" as "customer.code", ezu."login" as "customer.label", |
| 32 | 32 | ezu."company" AS "customer.company", ezu."vatid" AS "customer.vatid", |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | /*-orderby*/ ORDER BY :order /*orderby-*/ |
| 49 | 49 | LIMIT :size OFFSET :start |
| 50 | 50 | ', |
| 51 | - ), |
|
| 52 | - 'count' => array( |
|
| 53 | - 'ansi' => ' |
|
| 51 | + ), |
|
| 52 | + 'count' => array( |
|
| 53 | + 'ansi' => ' |
|
| 54 | 54 | SELECT COUNT(*) AS "count" |
| 55 | 55 | FROM ( |
| 56 | 56 | SELECT DISTINCT ezu."contentobject_id" |
@@ -60,5 +60,5 @@ discard block |
||
| 60 | 60 | LIMIT 10000 OFFSET 0 |
| 61 | 61 | ) AS list |
| 62 | 62 | ', |
| 63 | - ), |
|
| 63 | + ), |
|
| 64 | 64 | ); |
@@ -6,14 +6,14 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'delete' => array( |
|
| 10 | - 'ansi' => ' |
|
| 9 | + 'delete' => array( |
|
| 10 | + 'ansi' => ' |
|
| 11 | 11 | DELETE FROM "ezuser_address" |
| 12 | 12 | WHERE :cond |
| 13 | 13 | ', |
| 14 | - ), |
|
| 15 | - 'insert' => array( |
|
| 16 | - 'ansi' => ' |
|
| 14 | + ), |
|
| 15 | + 'insert' => array( |
|
| 16 | + 'ansi' => ' |
|
| 17 | 17 | INSERT INTO "ezuser_address" ( |
| 18 | 18 | "siteid", "parentid", "company", "vatid", "salutation", "title", |
| 19 | 19 | "firstname", "lastname", "address1", "address2", "address3", |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? |
| 25 | 25 | ) |
| 26 | 26 | ', |
| 27 | - ), |
|
| 28 | - 'update' => array( |
|
| 29 | - 'ansi' => ' |
|
| 27 | + ), |
|
| 28 | + 'update' => array( |
|
| 29 | + 'ansi' => ' |
|
| 30 | 30 | UPDATE "ezuser_address" |
| 31 | 31 | SET "siteid" = ?, "parentid" = ?, "company" = ?, "vatid" = ?, "salutation" = ?, |
| 32 | 32 | "title" = ?, "firstname" = ?, "lastname" = ?, "address1" = ?, |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | "pos" = ?, "mtime" = ?, "editor" = ? |
| 37 | 37 | WHERE "id" = ? |
| 38 | 38 | ', |
| 39 | - ), |
|
| 40 | - 'search' => array( |
|
| 41 | - 'ansi' => ' |
|
| 39 | + ), |
|
| 40 | + 'search' => array( |
|
| 41 | + 'ansi' => ' |
|
| 42 | 42 | SELECT DISTINCT ezuad."id" AS "customer.address.id", ezuad."parentid" AS "customer.address.parentid", |
| 43 | 43 | ezuad."company" AS "customer.address.company", ezuad."vatid" AS "customer.address.vatid", |
| 44 | 44 | ezuad."salutation" AS "customer.address.salutation", ezuad."title" AS "customer.address.title", |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | /*-orderby*/ ORDER BY :order /*orderby-*/ |
| 59 | 59 | LIMIT :size OFFSET :start |
| 60 | 60 | ', |
| 61 | - ), |
|
| 62 | - 'count' => array( |
|
| 63 | - 'ansi' => ' |
|
| 61 | + ), |
|
| 62 | + 'count' => array( |
|
| 63 | + 'ansi' => ' |
|
| 64 | 64 | SELECT COUNT(*) AS "count" |
| 65 | 65 | FROM ( |
| 66 | 66 | SELECT DISTINCT ezuad."id" |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | LIMIT 10000 OFFSET 0 |
| 71 | 71 | ) AS list |
| 72 | 72 | ', |
| 73 | - ), |
|
| 74 | - 'newid' => array( |
|
| 75 | - 'db2' => 'SELECT IDENTITY_VAL_LOCAL()', |
|
| 76 | - 'mysql' => 'SELECT LAST_INSERT_ID()', |
|
| 77 | - 'oracle' => 'SELECT ezuser_address.CURRVAL FROM DUAL', |
|
| 78 | - 'pgsql' => 'SELECT lastval()', |
|
| 79 | - 'sqlite' => 'SELECT last_insert_rowid()', |
|
| 80 | - 'sqlsrv' => 'SELECT SCOPE_IDENTITY()', |
|
| 81 | - 'sqlanywhere' => 'SELECT @@IDENTITY', |
|
| 82 | - ), |
|
| 73 | + ), |
|
| 74 | + 'newid' => array( |
|
| 75 | + 'db2' => 'SELECT IDENTITY_VAL_LOCAL()', |
|
| 76 | + 'mysql' => 'SELECT LAST_INSERT_ID()', |
|
| 77 | + 'oracle' => 'SELECT ezuser_address.CURRVAL FROM DUAL', |
|
| 78 | + 'pgsql' => 'SELECT lastval()', |
|
| 79 | + 'sqlite' => 'SELECT last_insert_rowid()', |
|
| 80 | + 'sqlsrv' => 'SELECT SCOPE_IDENTITY()', |
|
| 81 | + 'sqlanywhere' => 'SELECT @@IDENTITY', |
|
| 82 | + ), |
|
| 83 | 83 | ); |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'aggregate' => array( |
|
| 10 | - 'ansi' => ' |
|
| 9 | + 'aggregate' => array( |
|
| 10 | + 'ansi' => ' |
|
| 11 | 11 | SELECT "key", COUNT(DISTINCT "id") AS "count" |
| 12 | 12 | FROM ( |
| 13 | 13 | SELECT :key AS "key", ezuli."id" AS "id" |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | ) AS list |
| 20 | 20 | GROUP BY "key" |
| 21 | 21 | ', |
| 22 | - ), |
|
| 23 | - 'getposmax' => array( |
|
| 24 | - 'ansi' => ' |
|
| 22 | + ), |
|
| 23 | + 'getposmax' => array( |
|
| 24 | + 'ansi' => ' |
|
| 25 | 25 | SELECT MAX( "pos" ) AS pos |
| 26 | 26 | FROM "ezuser_list" |
| 27 | 27 | WHERE "siteid" = ? |
@@ -29,37 +29,37 @@ discard block |
||
| 29 | 29 | AND "typeid" = ? |
| 30 | 30 | AND "domain" = ? |
| 31 | 31 | ', |
| 32 | - ), |
|
| 33 | - 'insert' => array( |
|
| 34 | - 'ansi' => ' |
|
| 32 | + ), |
|
| 33 | + 'insert' => array( |
|
| 34 | + 'ansi' => ' |
|
| 35 | 35 | INSERT INTO "ezuser_list"( "parentid", "siteid", "typeid", "domain", "refid", "start", "end", |
| 36 | 36 | "config", "pos", "status", "mtime", "editor", "ctime" ) |
| 37 | 37 | VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) |
| 38 | 38 | ', |
| 39 | - ), |
|
| 40 | - 'update' => array( |
|
| 41 | - 'ansi' => ' |
|
| 39 | + ), |
|
| 40 | + 'update' => array( |
|
| 41 | + 'ansi' => ' |
|
| 42 | 42 | UPDATE "ezuser_list" |
| 43 | 43 | SET "parentid"=?, "siteid" = ?, "typeid" = ?, "domain" = ?, "refid" = ?, "start" = ?, "end" = ?, |
| 44 | 44 | "config" = ?, "pos" = ?, "status" = ?, "mtime" = ?, "editor" = ? |
| 45 | 45 | WHERE "id" = ? |
| 46 | 46 | ', |
| 47 | - ), |
|
| 48 | - 'updatepos' => array( |
|
| 49 | - 'ansi' => ' |
|
| 47 | + ), |
|
| 48 | + 'updatepos' => array( |
|
| 49 | + 'ansi' => ' |
|
| 50 | 50 | UPDATE "ezuser_list" |
| 51 | 51 | SET "pos" = ?, "mtime" = ?, "editor" = ? |
| 52 | 52 | WHERE "id" = ? |
| 53 | 53 | ', |
| 54 | - ), |
|
| 55 | - 'delete' => array( |
|
| 56 | - 'ansi' => ' |
|
| 54 | + ), |
|
| 55 | + 'delete' => array( |
|
| 56 | + 'ansi' => ' |
|
| 57 | 57 | DELETE FROM "ezuser_list" |
| 58 | 58 | WHERE :cond AND siteid = ? |
| 59 | 59 | ', |
| 60 | - ), |
|
| 61 | - 'move' => array( |
|
| 62 | - 'ansi' => ' |
|
| 60 | + ), |
|
| 61 | + 'move' => array( |
|
| 62 | + 'ansi' => ' |
|
| 63 | 63 | UPDATE "ezuser_list" |
| 64 | 64 | SET "pos" = "pos" + ?, "mtime" = ?, "editor" = ? |
| 65 | 65 | WHERE "siteid" = ? |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | AND "domain" = ? |
| 69 | 69 | AND "pos" >= ? |
| 70 | 70 | ', |
| 71 | - ), |
|
| 72 | - 'search' => array( |
|
| 73 | - 'ansi' => ' |
|
| 71 | + ), |
|
| 72 | + 'search' => array( |
|
| 73 | + 'ansi' => ' |
|
| 74 | 74 | SELECT ezuli."id" AS "customer.lists.id", ezuli."siteid" AS "customer.lists.siteid", |
| 75 | 75 | ezuli."parentid" AS "customer.lists.parentid", ezuli."typeid" AS "customer.lists.typeid", |
| 76 | 76 | ezuli."domain" AS "customer.lists.domain", ezuli."refid" AS "customer.lists.refid", |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | /*-orderby*/ ORDER BY :order /*orderby-*/ |
| 85 | 85 | LIMIT :size OFFSET :start |
| 86 | 86 | ', |
| 87 | - ), |
|
| 88 | - 'count' => array( |
|
| 89 | - 'ansi' => ' |
|
| 87 | + ), |
|
| 88 | + 'count' => array( |
|
| 89 | + 'ansi' => ' |
|
| 90 | 90 | SELECT COUNT(*) AS "count" |
| 91 | 91 | FROM ( |
| 92 | 92 | SELECT DISTINCT ezuli."id" |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | LIMIT 10000 OFFSET 0 |
| 97 | 97 | ) AS list |
| 98 | 98 | ', |
| 99 | - ), |
|
| 100 | - 'newid' => array( |
|
| 101 | - 'db2' => 'SELECT IDENTITY_VAL_LOCAL()', |
|
| 102 | - 'mysql' => 'SELECT LAST_INSERT_ID()', |
|
| 103 | - 'oracle' => 'SELECT ezuser_list.CURRVAL FROM DUAL', |
|
| 104 | - 'pgsql' => 'SELECT lastval()', |
|
| 105 | - 'sqlite' => 'SELECT last_insert_rowid()', |
|
| 106 | - 'sqlsrv' => 'SELECT SCOPE_IDENTITY()', |
|
| 107 | - 'sqlanywhere' => 'SELECT @@IDENTITY', |
|
| 108 | - ), |
|
| 99 | + ), |
|
| 100 | + 'newid' => array( |
|
| 101 | + 'db2' => 'SELECT IDENTITY_VAL_LOCAL()', |
|
| 102 | + 'mysql' => 'SELECT LAST_INSERT_ID()', |
|
| 103 | + 'oracle' => 'SELECT ezuser_list.CURRVAL FROM DUAL', |
|
| 104 | + 'pgsql' => 'SELECT lastval()', |
|
| 105 | + 'sqlite' => 'SELECT last_insert_rowid()', |
|
| 106 | + 'sqlsrv' => 'SELECT SCOPE_IDENTITY()', |
|
| 107 | + 'sqlanywhere' => 'SELECT @@IDENTITY', |
|
| 108 | + ), |
|
| 109 | 109 | ); |
@@ -6,28 +6,28 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'insert' => array( |
|
| 10 | - 'ansi' => ' |
|
| 9 | + 'insert' => array( |
|
| 10 | + 'ansi' => ' |
|
| 11 | 11 | INSERT INTO "ezuser_list_type"( "siteid", "code", "domain", "label", "status", |
| 12 | 12 | "mtime", "editor", "ctime" ) |
| 13 | 13 | VALUES ( ?, ?, ?, ?, ?, ?, ?, ? ) |
| 14 | 14 | ', |
| 15 | - ), |
|
| 16 | - 'update' => array( |
|
| 17 | - 'ansi' => ' |
|
| 15 | + ), |
|
| 16 | + 'update' => array( |
|
| 17 | + 'ansi' => ' |
|
| 18 | 18 | UPDATE "ezuser_list_type" |
| 19 | 19 | SET "siteid"=?, "code" = ?, "domain" = ?, "label" = ?, "status" = ?, "mtime" = ?, "editor" = ? |
| 20 | 20 | WHERE "id" = ? |
| 21 | 21 | ', |
| 22 | - ), |
|
| 23 | - 'delete' => array( |
|
| 24 | - 'ansi' => ' |
|
| 22 | + ), |
|
| 23 | + 'delete' => array( |
|
| 24 | + 'ansi' => ' |
|
| 25 | 25 | DELETE FROM "ezuser_list_type" |
| 26 | 26 | WHERE :cond AND siteid = ? |
| 27 | 27 | ', |
| 28 | - ), |
|
| 29 | - 'search' => array( |
|
| 30 | - 'ansi' => ' |
|
| 28 | + ), |
|
| 29 | + 'search' => array( |
|
| 30 | + 'ansi' => ' |
|
| 31 | 31 | SELECT ezulity."id" AS "customer.lists.type.id", ezulity."siteid" AS "customer.lists.type.siteid", |
| 32 | 32 | ezulity."code" AS "customer.lists.type.code", ezulity."domain" AS "customer.lists.type.domain", |
| 33 | 33 | ezulity."label" AS "customer.lists.type.label", ezulity."status" AS "customer.lists.type.status", |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | /*-orderby*/ ORDER BY :order /*orderby-*/ |
| 41 | 41 | LIMIT :size OFFSET :start |
| 42 | 42 | ', |
| 43 | - ), |
|
| 44 | - 'count' => array( |
|
| 45 | - 'ansi' => ' |
|
| 43 | + ), |
|
| 44 | + 'count' => array( |
|
| 45 | + 'ansi' => ' |
|
| 46 | 46 | SELECT COUNT(*) AS "count" |
| 47 | 47 | FROM ( |
| 48 | 48 | SELECT DISTINCT ezulity."id" |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | LIMIT 10000 OFFSET 0 |
| 53 | 53 | ) AS LIST |
| 54 | 54 | ', |
| 55 | - ), |
|
| 56 | - 'newid' => array( |
|
| 57 | - 'db2' => 'SELECT IDENTITY_VAL_LOCAL()', |
|
| 58 | - 'mysql' => 'SELECT LAST_INSERT_ID()', |
|
| 59 | - 'oracle' => 'SELECT ezuser_list_type.CURRVAL FROM DUAL', |
|
| 60 | - 'pgsql' => 'SELECT lastval()', |
|
| 61 | - 'sqlite' => 'SELECT last_insert_rowid()', |
|
| 62 | - 'sqlsrv' => 'SELECT SCOPE_IDENTITY()', |
|
| 63 | - 'sqlanywhere' => 'SELECT @@IDENTITY', |
|
| 64 | - ), |
|
| 55 | + ), |
|
| 56 | + 'newid' => array( |
|
| 57 | + 'db2' => 'SELECT IDENTITY_VAL_LOCAL()', |
|
| 58 | + 'mysql' => 'SELECT LAST_INSERT_ID()', |
|
| 59 | + 'oracle' => 'SELECT ezuser_list_type.CURRVAL FROM DUAL', |
|
| 60 | + 'pgsql' => 'SELECT lastval()', |
|
| 61 | + 'sqlite' => 'SELECT last_insert_rowid()', |
|
| 62 | + 'sqlsrv' => 'SELECT SCOPE_IDENTITY()', |
|
| 63 | + 'sqlanywhere' => 'SELECT @@IDENTITY', |
|
| 64 | + ), |
|
| 65 | 65 | ); |
@@ -11,34 +11,34 @@ |
||
| 11 | 11 | |
| 12 | 12 | class EzpublishTest extends \PHPUnit_Framework_TestCase |
| 13 | 13 | { |
| 14 | - private $object; |
|
| 14 | + private $object; |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | - protected function setUp() |
|
| 18 | - { |
|
| 19 | - $this->object = new \Aimeos\MShop\Context\Item\Ezpublish(); |
|
| 20 | - } |
|
| 17 | + protected function setUp() |
|
| 18 | + { |
|
| 19 | + $this->object = new \Aimeos\MShop\Context\Item\Ezpublish(); |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | 22 | |
| 23 | - protected function tearDown() |
|
| 24 | - { |
|
| 25 | - unset( $this->object ); |
|
| 26 | - } |
|
| 23 | + protected function tearDown() |
|
| 24 | + { |
|
| 25 | + unset( $this->object ); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | - public function testGetEzUser() |
|
| 30 | - { |
|
| 31 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 32 | - $this->object->getEzUser(); |
|
| 33 | - } |
|
| 29 | + public function testGetEzUser() |
|
| 30 | + { |
|
| 31 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 32 | + $this->object->getEzUser(); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | - public function testSetEzUser() |
|
| 37 | - { |
|
| 38 | - $closure = function() {}; |
|
| 39 | - $return = $this->object->setEzUser( $closure ); |
|
| 36 | + public function testSetEzUser() |
|
| 37 | + { |
|
| 38 | + $closure = function() {}; |
|
| 39 | + $return = $this->object->setEzUser( $closure ); |
|
| 40 | 40 | |
| 41 | - $this->assertSame( $closure, $this->object->getEzUser() ); |
|
| 42 | - $this->assertInstanceOf( '\Aimeos\MShop\Context\Item\Iface', $return ); |
|
| 43 | - } |
|
| 41 | + $this->assertSame( $closure, $this->object->getEzUser() ); |
|
| 42 | + $this->assertInstanceOf( '\Aimeos\MShop\Context\Item\Iface', $return ); |
|
| 43 | + } |
|
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -22,13 +22,13 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | protected function tearDown() |
| 24 | 24 | { |
| 25 | - unset( $this->object ); |
|
| 25 | + unset($this->object); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | public function testGetEzUser() |
| 30 | 30 | { |
| 31 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 31 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 32 | 32 | $this->object->getEzUser(); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | public function testSetEzUser() |
| 37 | 37 | { |
| 38 | 38 | $closure = function() {}; |
| 39 | - $return = $this->object->setEzUser( $closure ); |
|
| 39 | + $return = $this->object->setEzUser($closure); |
|
| 40 | 40 | |
| 41 | - $this->assertSame( $closure, $this->object->getEzUser() ); |
|
| 42 | - $this->assertInstanceOf( '\Aimeos\MShop\Context\Item\Iface', $return ); |
|
| 41 | + $this->assertSame($closure, $this->object->getEzUser()); |
|
| 42 | + $this->assertInstanceOf('\Aimeos\MShop\Context\Item\Iface', $return); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -11,311 +11,311 @@ |
||
| 11 | 11 | |
| 12 | 12 | class EzpublishTest extends \PHPUnit_Framework_TestCase |
| 13 | 13 | { |
| 14 | - private $object; |
|
| 15 | - private $context; |
|
| 16 | - private $editor = ''; |
|
| 17 | - |
|
| 18 | - |
|
| 19 | - protected function setUp() |
|
| 20 | - { |
|
| 21 | - $this->context = \TestHelper::getContext(); |
|
| 22 | - $this->editor = $this->context->getEditor(); |
|
| 23 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'Ezpublish' ); |
|
| 24 | - $this->object = $manager->getSubManager( 'lists', 'Ezpublish' ); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - |
|
| 28 | - protected function tearDown() |
|
| 29 | - { |
|
| 30 | - unset( $this->object, $this->context ); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - |
|
| 34 | - public function testCleanup() |
|
| 35 | - { |
|
| 36 | - $this->object->cleanup( array( -1 ) ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - public function testAggregate() |
|
| 41 | - { |
|
| 42 | - $search = $this->object->createSearch( true ); |
|
| 43 | - $expr = array( |
|
| 44 | - $search->getConditions(), |
|
| 45 | - $search->compare( '==', 'customer.lists.editor', 'ai-ezpublish:unittest' ), |
|
| 46 | - ); |
|
| 47 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 48 | - |
|
| 49 | - $result = $this->object->aggregate( $search, 'customer.lists.domain' ); |
|
| 50 | - |
|
| 51 | - $this->assertEquals( 1, count( $result ) ); |
|
| 52 | - $this->assertArrayHasKey( 'text', $result ); |
|
| 53 | - $this->assertEquals( 4, $result['text'] ); |
|
| 54 | - } |
|
| 14 | + private $object; |
|
| 15 | + private $context; |
|
| 16 | + private $editor = ''; |
|
| 17 | + |
|
| 18 | + |
|
| 19 | + protected function setUp() |
|
| 20 | + { |
|
| 21 | + $this->context = \TestHelper::getContext(); |
|
| 22 | + $this->editor = $this->context->getEditor(); |
|
| 23 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'Ezpublish' ); |
|
| 24 | + $this->object = $manager->getSubManager( 'lists', 'Ezpublish' ); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + |
|
| 28 | + protected function tearDown() |
|
| 29 | + { |
|
| 30 | + unset( $this->object, $this->context ); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + |
|
| 34 | + public function testCleanup() |
|
| 35 | + { |
|
| 36 | + $this->object->cleanup( array( -1 ) ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + public function testAggregate() |
|
| 41 | + { |
|
| 42 | + $search = $this->object->createSearch( true ); |
|
| 43 | + $expr = array( |
|
| 44 | + $search->getConditions(), |
|
| 45 | + $search->compare( '==', 'customer.lists.editor', 'ai-ezpublish:unittest' ), |
|
| 46 | + ); |
|
| 47 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 48 | + |
|
| 49 | + $result = $this->object->aggregate( $search, 'customer.lists.domain' ); |
|
| 50 | + |
|
| 51 | + $this->assertEquals( 1, count( $result ) ); |
|
| 52 | + $this->assertArrayHasKey( 'text', $result ); |
|
| 53 | + $this->assertEquals( 4, $result['text'] ); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | - public function testCreateItem() |
|
| 58 | - { |
|
| 59 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $this->object->createItem() ); |
|
| 60 | - } |
|
| 61 | - |
|
| 57 | + public function testCreateItem() |
|
| 58 | + { |
|
| 59 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $this->object->createItem() ); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | 62 | |
| 63 | - public function testGetItem() |
|
| 64 | - { |
|
| 65 | - $search = $this->object->createSearch(); |
|
| 66 | - $search->setSlice(0, 1); |
|
| 67 | - $results = $this->object->searchItems( $search ); |
|
| 63 | + public function testGetItem() |
|
| 64 | + { |
|
| 65 | + $search = $this->object->createSearch(); |
|
| 66 | + $search->setSlice(0, 1); |
|
| 67 | + $results = $this->object->searchItems( $search ); |
|
| 68 | 68 | |
| 69 | - if( ( $item = reset( $results ) ) === false ) { |
|
| 70 | - throw new \Exception( 'No item found' ); |
|
| 71 | - } |
|
| 69 | + if( ( $item = reset( $results ) ) === false ) { |
|
| 70 | + throw new \Exception( 'No item found' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - $this->assertEquals( $item, $this->object->getItem( $item->getId() ) ); |
|
| 74 | - } |
|
| 73 | + $this->assertEquals( $item, $this->object->getItem( $item->getId() ) ); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | - public function testSaveUpdateDeleteItem() |
|
| 78 | - { |
|
| 79 | - $search = $this->object->createSearch(); |
|
| 80 | - $search->setSlice(0, 1); |
|
| 81 | - $items = $this->object->searchItems( $search ); |
|
| 77 | + public function testSaveUpdateDeleteItem() |
|
| 78 | + { |
|
| 79 | + $search = $this->object->createSearch(); |
|
| 80 | + $search->setSlice(0, 1); |
|
| 81 | + $items = $this->object->searchItems( $search ); |
|
| 82 | 82 | |
| 83 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 84 | - throw new \Exception( 'No item found' ); |
|
| 85 | - } |
|
| 83 | + if( ( $item = reset( $items ) ) === false ) { |
|
| 84 | + throw new \Exception( 'No item found' ); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - $item->setId( null ); |
|
| 88 | - $item->setDomain( 'unittest' ); |
|
| 89 | - $this->object->saveItem( $item ); |
|
| 90 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 87 | + $item->setId( null ); |
|
| 88 | + $item->setDomain( 'unittest' ); |
|
| 89 | + $this->object->saveItem( $item ); |
|
| 90 | + $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 91 | 91 | |
| 92 | - $itemExp = clone $itemSaved; |
|
| 93 | - $itemExp->setDomain( 'unittest2' ); |
|
| 94 | - $this->object->saveItem( $itemExp ); |
|
| 95 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 92 | + $itemExp = clone $itemSaved; |
|
| 93 | + $itemExp->setDomain( 'unittest2' ); |
|
| 94 | + $this->object->saveItem( $itemExp ); |
|
| 95 | + $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 96 | 96 | |
| 97 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 97 | + $this->object->deleteItem( $itemSaved->getId() ); |
|
| 98 | 98 | |
| 99 | 99 | |
| 100 | - $this->assertTrue( $item->getId() !== null ); |
|
| 101 | - $this->assertTrue( $itemSaved->getType() !== null ); |
|
| 102 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 103 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 104 | - $this->assertEquals( $item->getParentId(), $itemSaved->getParentId() ); |
|
| 105 | - $this->assertEquals( $item->getTypeId(), $itemSaved->getTypeId() ); |
|
| 106 | - $this->assertEquals( $item->getRefId(), $itemSaved->getRefId() ); |
|
| 107 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
| 108 | - $this->assertEquals( $item->getDateStart(), $itemSaved->getDateStart() ); |
|
| 109 | - $this->assertEquals( $item->getDateEnd(), $itemSaved->getDateEnd() ); |
|
| 110 | - $this->assertEquals( $item->getPosition(), $itemSaved->getPosition() ); |
|
| 111 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 112 | - $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeCreated()); |
|
| 113 | - $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeModified()); |
|
| 100 | + $this->assertTrue( $item->getId() !== null ); |
|
| 101 | + $this->assertTrue( $itemSaved->getType() !== null ); |
|
| 102 | + $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 103 | + $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 104 | + $this->assertEquals( $item->getParentId(), $itemSaved->getParentId() ); |
|
| 105 | + $this->assertEquals( $item->getTypeId(), $itemSaved->getTypeId() ); |
|
| 106 | + $this->assertEquals( $item->getRefId(), $itemSaved->getRefId() ); |
|
| 107 | + $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
| 108 | + $this->assertEquals( $item->getDateStart(), $itemSaved->getDateStart() ); |
|
| 109 | + $this->assertEquals( $item->getDateEnd(), $itemSaved->getDateEnd() ); |
|
| 110 | + $this->assertEquals( $item->getPosition(), $itemSaved->getPosition() ); |
|
| 111 | + $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 112 | + $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeCreated()); |
|
| 113 | + $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeModified()); |
|
| 114 | 114 | |
| 115 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 116 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 117 | - $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 115 | + $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 116 | + $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 117 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 118 | 118 | |
| 119 | - $this->assertTrue( $itemUpd->getType() !== null ); |
|
| 120 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 121 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 122 | - $this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() ); |
|
| 123 | - $this->assertEquals( $itemExp->getTypeId(), $itemUpd->getTypeId() ); |
|
| 124 | - $this->assertEquals( $itemExp->getRefId(), $itemUpd->getRefId() ); |
|
| 125 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
| 126 | - $this->assertEquals( $itemExp->getDateStart(), $itemUpd->getDateStart() ); |
|
| 127 | - $this->assertEquals( $itemExp->getDateEnd(), $itemUpd->getDateEnd() ); |
|
| 128 | - $this->assertEquals( $itemExp->getPosition(), $itemUpd->getPosition() ); |
|
| 119 | + $this->assertTrue( $itemUpd->getType() !== null ); |
|
| 120 | + $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 121 | + $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 122 | + $this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() ); |
|
| 123 | + $this->assertEquals( $itemExp->getTypeId(), $itemUpd->getTypeId() ); |
|
| 124 | + $this->assertEquals( $itemExp->getRefId(), $itemUpd->getRefId() ); |
|
| 125 | + $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
| 126 | + $this->assertEquals( $itemExp->getDateStart(), $itemUpd->getDateStart() ); |
|
| 127 | + $this->assertEquals( $itemExp->getDateEnd(), $itemUpd->getDateEnd() ); |
|
| 128 | + $this->assertEquals( $itemExp->getPosition(), $itemUpd->getPosition() ); |
|
| 129 | 129 | |
| 130 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 131 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 132 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 130 | + $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 131 | + $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 132 | + $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 133 | 133 | |
| 134 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 135 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 136 | - } |
|
| 134 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 135 | + $this->object->getItem( $itemSaved->getId() ); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | 138 | |
| 139 | - public function testMoveItemLastToFront() |
|
| 140 | - { |
|
| 141 | - $listItems = $this->getListItems(); |
|
| 142 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 139 | + public function testMoveItemLastToFront() |
|
| 140 | + { |
|
| 141 | + $listItems = $this->getListItems(); |
|
| 142 | + $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 143 | 143 | |
| 144 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
| 145 | - throw new \Exception( 'No first customer list item' ); |
|
| 146 | - } |
|
| 144 | + if( ( $first = reset( $listItems ) ) === false ) { |
|
| 145 | + throw new \Exception( 'No first customer list item' ); |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - if( ( $last = end( $listItems ) ) === false ) { |
|
| 149 | - throw new \Exception( 'No last customer list item' ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - $this->object->moveItem( $last->getId(), $first->getId() ); |
|
| 153 | - |
|
| 154 | - $newFirst = $this->object->getItem( $last->getId() ); |
|
| 155 | - $newSecond = $this->object->getItem( $first->getId() ); |
|
| 156 | - |
|
| 157 | - $this->object->moveItem( $last->getId() ); |
|
| 158 | - |
|
| 159 | - $this->assertEquals( 0, $newFirst->getPosition() ); |
|
| 160 | - $this->assertEquals( 1, $newSecond->getPosition() ); |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - |
|
| 164 | - public function testMoveItemFirstToLast() |
|
| 165 | - { |
|
| 166 | - $listItems = $this->getListItems(); |
|
| 167 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 168 | - |
|
| 169 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
| 170 | - throw new \Exception( 'No first customer list item' ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - if( ( $second = next( $listItems ) ) === false ) { |
|
| 174 | - throw new \Exception( 'No second customer list item' ); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - if( ( $last = end( $listItems ) ) === false ) { |
|
| 178 | - throw new \Exception( 'No last customer list item' ); |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - $this->object->moveItem( $first->getId() ); |
|
| 182 | - |
|
| 183 | - $newBefore = $this->object->getItem( $last->getId() ); |
|
| 184 | - $newLast = $this->object->getItem( $first->getId() ); |
|
| 185 | - |
|
| 186 | - $this->object->moveItem( $first->getId(), $second->getId() ); |
|
| 187 | - |
|
| 188 | - $this->assertEquals( $last->getPosition() - 1, $newBefore->getPosition() ); |
|
| 189 | - $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - |
|
| 193 | - public function testMoveItemFirstUp() |
|
| 194 | - { |
|
| 195 | - $listItems = $this->getListItems(); |
|
| 196 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 197 | - |
|
| 198 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
| 199 | - throw new \Exception( 'No first customer list item' ); |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - if( ( $second = next( $listItems ) ) === false ) { |
|
| 203 | - throw new \Exception( 'No second customer list item' ); |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - if( ( $last = end( $listItems ) ) === false ) { |
|
| 207 | - throw new \Exception( 'No last customer list item' ); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - $this->object->moveItem( $first->getId(), $last->getId() ); |
|
| 211 | - |
|
| 212 | - $newLast = $this->object->getItem( $last->getId() ); |
|
| 213 | - $newUp = $this->object->getItem( $first->getId() ); |
|
| 214 | - |
|
| 215 | - $this->object->moveItem( $first->getId(), $second->getId() ); |
|
| 216 | - |
|
| 217 | - $this->assertEquals( $last->getPosition() - 1, $newUp->getPosition() ); |
|
| 218 | - $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - |
|
| 222 | - public function testSearchItems() |
|
| 223 | - { |
|
| 224 | - $total = 0; |
|
| 225 | - $search = $this->object->createSearch(); |
|
| 148 | + if( ( $last = end( $listItems ) ) === false ) { |
|
| 149 | + throw new \Exception( 'No last customer list item' ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + $this->object->moveItem( $last->getId(), $first->getId() ); |
|
| 153 | + |
|
| 154 | + $newFirst = $this->object->getItem( $last->getId() ); |
|
| 155 | + $newSecond = $this->object->getItem( $first->getId() ); |
|
| 156 | + |
|
| 157 | + $this->object->moveItem( $last->getId() ); |
|
| 158 | + |
|
| 159 | + $this->assertEquals( 0, $newFirst->getPosition() ); |
|
| 160 | + $this->assertEquals( 1, $newSecond->getPosition() ); |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + |
|
| 164 | + public function testMoveItemFirstToLast() |
|
| 165 | + { |
|
| 166 | + $listItems = $this->getListItems(); |
|
| 167 | + $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 168 | + |
|
| 169 | + if( ( $first = reset( $listItems ) ) === false ) { |
|
| 170 | + throw new \Exception( 'No first customer list item' ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + if( ( $second = next( $listItems ) ) === false ) { |
|
| 174 | + throw new \Exception( 'No second customer list item' ); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + if( ( $last = end( $listItems ) ) === false ) { |
|
| 178 | + throw new \Exception( 'No last customer list item' ); |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + $this->object->moveItem( $first->getId() ); |
|
| 182 | + |
|
| 183 | + $newBefore = $this->object->getItem( $last->getId() ); |
|
| 184 | + $newLast = $this->object->getItem( $first->getId() ); |
|
| 185 | + |
|
| 186 | + $this->object->moveItem( $first->getId(), $second->getId() ); |
|
| 187 | + |
|
| 188 | + $this->assertEquals( $last->getPosition() - 1, $newBefore->getPosition() ); |
|
| 189 | + $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + |
|
| 193 | + public function testMoveItemFirstUp() |
|
| 194 | + { |
|
| 195 | + $listItems = $this->getListItems(); |
|
| 196 | + $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 197 | + |
|
| 198 | + if( ( $first = reset( $listItems ) ) === false ) { |
|
| 199 | + throw new \Exception( 'No first customer list item' ); |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + if( ( $second = next( $listItems ) ) === false ) { |
|
| 203 | + throw new \Exception( 'No second customer list item' ); |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + if( ( $last = end( $listItems ) ) === false ) { |
|
| 207 | + throw new \Exception( 'No last customer list item' ); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + $this->object->moveItem( $first->getId(), $last->getId() ); |
|
| 211 | + |
|
| 212 | + $newLast = $this->object->getItem( $last->getId() ); |
|
| 213 | + $newUp = $this->object->getItem( $first->getId() ); |
|
| 214 | + |
|
| 215 | + $this->object->moveItem( $first->getId(), $second->getId() ); |
|
| 216 | + |
|
| 217 | + $this->assertEquals( $last->getPosition() - 1, $newUp->getPosition() ); |
|
| 218 | + $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + |
|
| 222 | + public function testSearchItems() |
|
| 223 | + { |
|
| 224 | + $total = 0; |
|
| 225 | + $search = $this->object->createSearch(); |
|
| 226 | 226 | |
| 227 | - $expr = array(); |
|
| 228 | - $expr[] = $search->compare( '!=', 'customer.lists.id', null ); |
|
| 229 | - $expr[] = $search->compare( '!=', 'customer.lists.siteid', null ); |
|
| 230 | - $expr[] = $search->compare( '!=', 'customer.lists.parentid', null ); |
|
| 231 | - $expr[] = $search->compare( '==', 'customer.lists.domain', 'text' ); |
|
| 232 | - $expr[] = $search->compare( '>', 'customer.lists.typeid', 0 ); |
|
| 233 | - $expr[] = $search->compare( '>', 'customer.lists.refid', 0 ); |
|
| 234 | - $expr[] = $search->compare( '==', 'customer.lists.datestart', '2010-01-01 00:00:00' ); |
|
| 235 | - $expr[] = $search->compare( '==', 'customer.lists.dateend', '2100-01-01 00:00:00' ); |
|
| 236 | - $expr[] = $search->compare( '!=', 'customer.lists.config', null ); |
|
| 237 | - $expr[] = $search->compare( '>', 'customer.lists.position', 0 ); |
|
| 238 | - $expr[] = $search->compare( '==', 'customer.lists.status', 1 ); |
|
| 239 | - $expr[] = $search->compare( '>=', 'customer.lists.mtime', '1970-01-01 00:00:00' ); |
|
| 240 | - $expr[] = $search->compare( '>=', 'customer.lists.ctime', '1970-01-01 00:00:00' ); |
|
| 241 | - $expr[] = $search->compare( '==', 'customer.lists.editor', $this->editor ); |
|
| 227 | + $expr = array(); |
|
| 228 | + $expr[] = $search->compare( '!=', 'customer.lists.id', null ); |
|
| 229 | + $expr[] = $search->compare( '!=', 'customer.lists.siteid', null ); |
|
| 230 | + $expr[] = $search->compare( '!=', 'customer.lists.parentid', null ); |
|
| 231 | + $expr[] = $search->compare( '==', 'customer.lists.domain', 'text' ); |
|
| 232 | + $expr[] = $search->compare( '>', 'customer.lists.typeid', 0 ); |
|
| 233 | + $expr[] = $search->compare( '>', 'customer.lists.refid', 0 ); |
|
| 234 | + $expr[] = $search->compare( '==', 'customer.lists.datestart', '2010-01-01 00:00:00' ); |
|
| 235 | + $expr[] = $search->compare( '==', 'customer.lists.dateend', '2100-01-01 00:00:00' ); |
|
| 236 | + $expr[] = $search->compare( '!=', 'customer.lists.config', null ); |
|
| 237 | + $expr[] = $search->compare( '>', 'customer.lists.position', 0 ); |
|
| 238 | + $expr[] = $search->compare( '==', 'customer.lists.status', 1 ); |
|
| 239 | + $expr[] = $search->compare( '>=', 'customer.lists.mtime', '1970-01-01 00:00:00' ); |
|
| 240 | + $expr[] = $search->compare( '>=', 'customer.lists.ctime', '1970-01-01 00:00:00' ); |
|
| 241 | + $expr[] = $search->compare( '==', 'customer.lists.editor', $this->editor ); |
|
| 242 | 242 | |
| 243 | - $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
| 244 | - $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
| 245 | - $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
| 246 | - $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
| 247 | - $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
| 248 | - $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
| 249 | - $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
| 250 | - $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
| 251 | - $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
| 252 | - |
|
| 253 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 254 | - $search->setSlice(0, 2); |
|
| 255 | - $results = $this->object->searchItems( $search, array(), $total ); |
|
| 256 | - $this->assertEquals( 2, count( $results ) ); |
|
| 257 | - $this->assertEquals( 3, $total ); |
|
| 258 | - |
|
| 259 | - foreach($results as $itemId => $item) { |
|
| 260 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 261 | - } |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - |
|
| 265 | - public function testSearchItemsNoCriteria() |
|
| 266 | - { |
|
| 267 | - $search = $this->object->createSearch(); |
|
| 268 | - $search->setConditions( $search->compare( '==', 'customer.lists.editor', $this->editor ) ); |
|
| 269 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - |
|
| 273 | - public function testSearchItemsBaseCriteria() |
|
| 274 | - { |
|
| 275 | - $search = $this->object->createSearch(true); |
|
| 276 | - $conditions = array( |
|
| 277 | - $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
| 278 | - $search->getConditions() |
|
| 279 | - ); |
|
| 280 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 281 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - |
|
| 285 | - public function testGetSubManager() |
|
| 286 | - { |
|
| 287 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
| 288 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
| 289 | - |
|
| 290 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 291 | - $this->object->getSubManager( 'unknown' ); |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - |
|
| 295 | - protected function getListItems() |
|
| 296 | - { |
|
| 297 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'Ezpublish' ); |
|
| 298 | - |
|
| 299 | - $search = $manager->createSearch(); |
|
| 300 | - $search->setConditions( $search->compare( '==', 'customer.code', 'UTC003' ) ); |
|
| 301 | - $search->setSlice( 0, 1 ); |
|
| 302 | - |
|
| 303 | - $results = $manager->searchItems( $search ); |
|
| 304 | - |
|
| 305 | - if( ( $item = reset( $results ) ) === false ) { |
|
| 306 | - throw new \Exception( 'No customer item found' ); |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - $search = $this->object->createSearch(); |
|
| 310 | - $expr = array( |
|
| 311 | - $search->compare( '==', 'customer.lists.parentid', $item->getId() ), |
|
| 312 | - $search->compare( '==', 'customer.lists.domain', 'text' ), |
|
| 313 | - $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
| 314 | - $search->compare( '==', 'customer.lists.type.code', 'default' ), |
|
| 315 | - ); |
|
| 316 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 317 | - $search->setSortations( array( $search->sort( '+', 'customer.lists.position' ) ) ); |
|
| 318 | - |
|
| 319 | - return $this->object->searchItems( $search ); |
|
| 320 | - } |
|
| 243 | + $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
| 244 | + $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
| 245 | + $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
| 246 | + $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
| 247 | + $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
| 248 | + $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
| 249 | + $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
| 250 | + $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
| 251 | + $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
| 252 | + |
|
| 253 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 254 | + $search->setSlice(0, 2); |
|
| 255 | + $results = $this->object->searchItems( $search, array(), $total ); |
|
| 256 | + $this->assertEquals( 2, count( $results ) ); |
|
| 257 | + $this->assertEquals( 3, $total ); |
|
| 258 | + |
|
| 259 | + foreach($results as $itemId => $item) { |
|
| 260 | + $this->assertEquals( $itemId, $item->getId() ); |
|
| 261 | + } |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + |
|
| 265 | + public function testSearchItemsNoCriteria() |
|
| 266 | + { |
|
| 267 | + $search = $this->object->createSearch(); |
|
| 268 | + $search->setConditions( $search->compare( '==', 'customer.lists.editor', $this->editor ) ); |
|
| 269 | + $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + |
|
| 273 | + public function testSearchItemsBaseCriteria() |
|
| 274 | + { |
|
| 275 | + $search = $this->object->createSearch(true); |
|
| 276 | + $conditions = array( |
|
| 277 | + $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
| 278 | + $search->getConditions() |
|
| 279 | + ); |
|
| 280 | + $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 281 | + $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + |
|
| 285 | + public function testGetSubManager() |
|
| 286 | + { |
|
| 287 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
| 288 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
| 289 | + |
|
| 290 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 291 | + $this->object->getSubManager( 'unknown' ); |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + |
|
| 295 | + protected function getListItems() |
|
| 296 | + { |
|
| 297 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'Ezpublish' ); |
|
| 298 | + |
|
| 299 | + $search = $manager->createSearch(); |
|
| 300 | + $search->setConditions( $search->compare( '==', 'customer.code', 'UTC003' ) ); |
|
| 301 | + $search->setSlice( 0, 1 ); |
|
| 302 | + |
|
| 303 | + $results = $manager->searchItems( $search ); |
|
| 304 | + |
|
| 305 | + if( ( $item = reset( $results ) ) === false ) { |
|
| 306 | + throw new \Exception( 'No customer item found' ); |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + $search = $this->object->createSearch(); |
|
| 310 | + $expr = array( |
|
| 311 | + $search->compare( '==', 'customer.lists.parentid', $item->getId() ), |
|
| 312 | + $search->compare( '==', 'customer.lists.domain', 'text' ), |
|
| 313 | + $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
| 314 | + $search->compare( '==', 'customer.lists.type.code', 'default' ), |
|
| 315 | + ); |
|
| 316 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 317 | + $search->setSortations( array( $search->sort( '+', 'customer.lists.position' ) ) ); |
|
| 318 | + |
|
| 319 | + return $this->object->searchItems( $search ); |
|
| 320 | + } |
|
| 321 | 321 | } |
@@ -20,43 +20,43 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | $this->context = \TestHelper::getContext(); |
| 22 | 22 | $this->editor = $this->context->getEditor(); |
| 23 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'Ezpublish' ); |
|
| 24 | - $this->object = $manager->getSubManager( 'lists', 'Ezpublish' ); |
|
| 23 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context, 'Ezpublish'); |
|
| 24 | + $this->object = $manager->getSubManager('lists', 'Ezpublish'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() |
| 29 | 29 | { |
| 30 | - unset( $this->object, $this->context ); |
|
| 30 | + unset($this->object, $this->context); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 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 testAggregate() |
| 41 | 41 | { |
| 42 | - $search = $this->object->createSearch( true ); |
|
| 42 | + $search = $this->object->createSearch(true); |
|
| 43 | 43 | $expr = array( |
| 44 | 44 | $search->getConditions(), |
| 45 | - $search->compare( '==', 'customer.lists.editor', 'ai-ezpublish:unittest' ), |
|
| 45 | + $search->compare('==', 'customer.lists.editor', 'ai-ezpublish:unittest'), |
|
| 46 | 46 | ); |
| 47 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 47 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 48 | 48 | |
| 49 | - $result = $this->object->aggregate( $search, 'customer.lists.domain' ); |
|
| 49 | + $result = $this->object->aggregate($search, 'customer.lists.domain'); |
|
| 50 | 50 | |
| 51 | - $this->assertEquals( 1, count( $result ) ); |
|
| 52 | - $this->assertArrayHasKey( 'text', $result ); |
|
| 53 | - $this->assertEquals( 4, $result['text'] ); |
|
| 51 | + $this->assertEquals(1, count($result)); |
|
| 52 | + $this->assertArrayHasKey('text', $result); |
|
| 53 | + $this->assertEquals(4, $result['text']); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | public function testCreateItem() |
| 58 | 58 | { |
| 59 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $this->object->createItem() ); |
|
| 59 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $this->object->createItem()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | $search = $this->object->createSearch(); |
| 66 | 66 | $search->setSlice(0, 1); |
| 67 | - $results = $this->object->searchItems( $search ); |
|
| 67 | + $results = $this->object->searchItems($search); |
|
| 68 | 68 | |
| 69 | - if( ( $item = reset( $results ) ) === false ) { |
|
| 70 | - throw new \Exception( 'No item found' ); |
|
| 69 | + if (($item = reset($results)) === false) { |
|
| 70 | + throw new \Exception('No item found'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $this->assertEquals( $item, $this->object->getItem( $item->getId() ) ); |
|
| 73 | + $this->assertEquals($item, $this->object->getItem($item->getId())); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -78,144 +78,144 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $search = $this->object->createSearch(); |
| 80 | 80 | $search->setSlice(0, 1); |
| 81 | - $items = $this->object->searchItems( $search ); |
|
| 81 | + $items = $this->object->searchItems($search); |
|
| 82 | 82 | |
| 83 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 84 | - throw new \Exception( 'No item found' ); |
|
| 83 | + if (($item = reset($items)) === false) { |
|
| 84 | + throw new \Exception('No item found'); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - $item->setId( null ); |
|
| 88 | - $item->setDomain( 'unittest' ); |
|
| 89 | - $this->object->saveItem( $item ); |
|
| 90 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 87 | + $item->setId(null); |
|
| 88 | + $item->setDomain('unittest'); |
|
| 89 | + $this->object->saveItem($item); |
|
| 90 | + $itemSaved = $this->object->getItem($item->getId()); |
|
| 91 | 91 | |
| 92 | 92 | $itemExp = clone $itemSaved; |
| 93 | - $itemExp->setDomain( 'unittest2' ); |
|
| 94 | - $this->object->saveItem( $itemExp ); |
|
| 95 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 96 | - |
|
| 97 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - $this->assertTrue( $item->getId() !== null ); |
|
| 101 | - $this->assertTrue( $itemSaved->getType() !== null ); |
|
| 102 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 103 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 104 | - $this->assertEquals( $item->getParentId(), $itemSaved->getParentId() ); |
|
| 105 | - $this->assertEquals( $item->getTypeId(), $itemSaved->getTypeId() ); |
|
| 106 | - $this->assertEquals( $item->getRefId(), $itemSaved->getRefId() ); |
|
| 107 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
| 108 | - $this->assertEquals( $item->getDateStart(), $itemSaved->getDateStart() ); |
|
| 109 | - $this->assertEquals( $item->getDateEnd(), $itemSaved->getDateEnd() ); |
|
| 110 | - $this->assertEquals( $item->getPosition(), $itemSaved->getPosition() ); |
|
| 111 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 93 | + $itemExp->setDomain('unittest2'); |
|
| 94 | + $this->object->saveItem($itemExp); |
|
| 95 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
| 96 | + |
|
| 97 | + $this->object->deleteItem($itemSaved->getId()); |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + $this->assertTrue($item->getId() !== null); |
|
| 101 | + $this->assertTrue($itemSaved->getType() !== null); |
|
| 102 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
| 103 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
| 104 | + $this->assertEquals($item->getParentId(), $itemSaved->getParentId()); |
|
| 105 | + $this->assertEquals($item->getTypeId(), $itemSaved->getTypeId()); |
|
| 106 | + $this->assertEquals($item->getRefId(), $itemSaved->getRefId()); |
|
| 107 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
| 108 | + $this->assertEquals($item->getDateStart(), $itemSaved->getDateStart()); |
|
| 109 | + $this->assertEquals($item->getDateEnd(), $itemSaved->getDateEnd()); |
|
| 110 | + $this->assertEquals($item->getPosition(), $itemSaved->getPosition()); |
|
| 111 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 112 | 112 | $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeCreated()); |
| 113 | 113 | $this->assertStringStartsWith(date('Y-m-d', time()), $itemSaved->getTimeModified()); |
| 114 | 114 | |
| 115 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 116 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 117 | - $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 118 | - |
|
| 119 | - $this->assertTrue( $itemUpd->getType() !== null ); |
|
| 120 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 121 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 122 | - $this->assertEquals( $itemExp->getParentId(), $itemUpd->getParentId() ); |
|
| 123 | - $this->assertEquals( $itemExp->getTypeId(), $itemUpd->getTypeId() ); |
|
| 124 | - $this->assertEquals( $itemExp->getRefId(), $itemUpd->getRefId() ); |
|
| 125 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
| 126 | - $this->assertEquals( $itemExp->getDateStart(), $itemUpd->getDateStart() ); |
|
| 127 | - $this->assertEquals( $itemExp->getDateEnd(), $itemUpd->getDateEnd() ); |
|
| 128 | - $this->assertEquals( $itemExp->getPosition(), $itemUpd->getPosition() ); |
|
| 129 | - |
|
| 130 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 131 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 132 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 115 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 116 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 117 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
| 118 | + |
|
| 119 | + $this->assertTrue($itemUpd->getType() !== null); |
|
| 120 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 121 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
| 122 | + $this->assertEquals($itemExp->getParentId(), $itemUpd->getParentId()); |
|
| 123 | + $this->assertEquals($itemExp->getTypeId(), $itemUpd->getTypeId()); |
|
| 124 | + $this->assertEquals($itemExp->getRefId(), $itemUpd->getRefId()); |
|
| 125 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
| 126 | + $this->assertEquals($itemExp->getDateStart(), $itemUpd->getDateStart()); |
|
| 127 | + $this->assertEquals($itemExp->getDateEnd(), $itemUpd->getDateEnd()); |
|
| 128 | + $this->assertEquals($itemExp->getPosition(), $itemUpd->getPosition()); |
|
| 129 | + |
|
| 130 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
| 131 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 132 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 133 | 133 | |
| 134 | 134 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
| 135 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 135 | + $this->object->getItem($itemSaved->getId()); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | public function testMoveItemLastToFront() |
| 140 | 140 | { |
| 141 | 141 | $listItems = $this->getListItems(); |
| 142 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 142 | + $this->assertGreaterThan(1, count($listItems)); |
|
| 143 | 143 | |
| 144 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
| 145 | - throw new \Exception( 'No first customer list item' ); |
|
| 144 | + if (($first = reset($listItems)) === false) { |
|
| 145 | + throw new \Exception('No first customer list item'); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if( ( $last = end( $listItems ) ) === false ) { |
|
| 149 | - throw new \Exception( 'No last customer list item' ); |
|
| 148 | + if (($last = end($listItems)) === false) { |
|
| 149 | + throw new \Exception('No last customer list item'); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $this->object->moveItem( $last->getId(), $first->getId() ); |
|
| 152 | + $this->object->moveItem($last->getId(), $first->getId()); |
|
| 153 | 153 | |
| 154 | - $newFirst = $this->object->getItem( $last->getId() ); |
|
| 155 | - $newSecond = $this->object->getItem( $first->getId() ); |
|
| 154 | + $newFirst = $this->object->getItem($last->getId()); |
|
| 155 | + $newSecond = $this->object->getItem($first->getId()); |
|
| 156 | 156 | |
| 157 | - $this->object->moveItem( $last->getId() ); |
|
| 157 | + $this->object->moveItem($last->getId()); |
|
| 158 | 158 | |
| 159 | - $this->assertEquals( 0, $newFirst->getPosition() ); |
|
| 160 | - $this->assertEquals( 1, $newSecond->getPosition() ); |
|
| 159 | + $this->assertEquals(0, $newFirst->getPosition()); |
|
| 160 | + $this->assertEquals(1, $newSecond->getPosition()); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | public function testMoveItemFirstToLast() |
| 165 | 165 | { |
| 166 | 166 | $listItems = $this->getListItems(); |
| 167 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 167 | + $this->assertGreaterThan(1, count($listItems)); |
|
| 168 | 168 | |
| 169 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
| 170 | - throw new \Exception( 'No first customer list item' ); |
|
| 169 | + if (($first = reset($listItems)) === false) { |
|
| 170 | + throw new \Exception('No first customer list item'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - if( ( $second = next( $listItems ) ) === false ) { |
|
| 174 | - throw new \Exception( 'No second customer list item' ); |
|
| 173 | + if (($second = next($listItems)) === false) { |
|
| 174 | + throw new \Exception('No second customer list item'); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if( ( $last = end( $listItems ) ) === false ) { |
|
| 178 | - throw new \Exception( 'No last customer list item' ); |
|
| 177 | + if (($last = end($listItems)) === false) { |
|
| 178 | + throw new \Exception('No last customer list item'); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - $this->object->moveItem( $first->getId() ); |
|
| 181 | + $this->object->moveItem($first->getId()); |
|
| 182 | 182 | |
| 183 | - $newBefore = $this->object->getItem( $last->getId() ); |
|
| 184 | - $newLast = $this->object->getItem( $first->getId() ); |
|
| 183 | + $newBefore = $this->object->getItem($last->getId()); |
|
| 184 | + $newLast = $this->object->getItem($first->getId()); |
|
| 185 | 185 | |
| 186 | - $this->object->moveItem( $first->getId(), $second->getId() ); |
|
| 186 | + $this->object->moveItem($first->getId(), $second->getId()); |
|
| 187 | 187 | |
| 188 | - $this->assertEquals( $last->getPosition() - 1, $newBefore->getPosition() ); |
|
| 189 | - $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
| 188 | + $this->assertEquals($last->getPosition() - 1, $newBefore->getPosition()); |
|
| 189 | + $this->assertEquals($last->getPosition(), $newLast->getPosition()); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | public function testMoveItemFirstUp() |
| 194 | 194 | { |
| 195 | 195 | $listItems = $this->getListItems(); |
| 196 | - $this->assertGreaterThan( 1, count( $listItems ) ); |
|
| 196 | + $this->assertGreaterThan(1, count($listItems)); |
|
| 197 | 197 | |
| 198 | - if( ( $first = reset( $listItems ) ) === false ) { |
|
| 199 | - throw new \Exception( 'No first customer list item' ); |
|
| 198 | + if (($first = reset($listItems)) === false) { |
|
| 199 | + throw new \Exception('No first customer list item'); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if( ( $second = next( $listItems ) ) === false ) { |
|
| 203 | - throw new \Exception( 'No second customer list item' ); |
|
| 202 | + if (($second = next($listItems)) === false) { |
|
| 203 | + throw new \Exception('No second customer list item'); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if( ( $last = end( $listItems ) ) === false ) { |
|
| 207 | - throw new \Exception( 'No last customer list item' ); |
|
| 206 | + if (($last = end($listItems)) === false) { |
|
| 207 | + throw new \Exception('No last customer list item'); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - $this->object->moveItem( $first->getId(), $last->getId() ); |
|
| 210 | + $this->object->moveItem($first->getId(), $last->getId()); |
|
| 211 | 211 | |
| 212 | - $newLast = $this->object->getItem( $last->getId() ); |
|
| 213 | - $newUp = $this->object->getItem( $first->getId() ); |
|
| 212 | + $newLast = $this->object->getItem($last->getId()); |
|
| 213 | + $newUp = $this->object->getItem($first->getId()); |
|
| 214 | 214 | |
| 215 | - $this->object->moveItem( $first->getId(), $second->getId() ); |
|
| 215 | + $this->object->moveItem($first->getId(), $second->getId()); |
|
| 216 | 216 | |
| 217 | - $this->assertEquals( $last->getPosition() - 1, $newUp->getPosition() ); |
|
| 218 | - $this->assertEquals( $last->getPosition(), $newLast->getPosition() ); |
|
| 217 | + $this->assertEquals($last->getPosition() - 1, $newUp->getPosition()); |
|
| 218 | + $this->assertEquals($last->getPosition(), $newLast->getPosition()); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | |
@@ -225,39 +225,39 @@ discard block |
||
| 225 | 225 | $search = $this->object->createSearch(); |
| 226 | 226 | |
| 227 | 227 | $expr = array(); |
| 228 | - $expr[] = $search->compare( '!=', 'customer.lists.id', null ); |
|
| 229 | - $expr[] = $search->compare( '!=', 'customer.lists.siteid', null ); |
|
| 230 | - $expr[] = $search->compare( '!=', 'customer.lists.parentid', null ); |
|
| 231 | - $expr[] = $search->compare( '==', 'customer.lists.domain', 'text' ); |
|
| 232 | - $expr[] = $search->compare( '>', 'customer.lists.typeid', 0 ); |
|
| 233 | - $expr[] = $search->compare( '>', 'customer.lists.refid', 0 ); |
|
| 234 | - $expr[] = $search->compare( '==', 'customer.lists.datestart', '2010-01-01 00:00:00' ); |
|
| 235 | - $expr[] = $search->compare( '==', 'customer.lists.dateend', '2100-01-01 00:00:00' ); |
|
| 236 | - $expr[] = $search->compare( '!=', 'customer.lists.config', null ); |
|
| 237 | - $expr[] = $search->compare( '>', 'customer.lists.position', 0 ); |
|
| 238 | - $expr[] = $search->compare( '==', 'customer.lists.status', 1 ); |
|
| 239 | - $expr[] = $search->compare( '>=', 'customer.lists.mtime', '1970-01-01 00:00:00' ); |
|
| 240 | - $expr[] = $search->compare( '>=', 'customer.lists.ctime', '1970-01-01 00:00:00' ); |
|
| 241 | - $expr[] = $search->compare( '==', 'customer.lists.editor', $this->editor ); |
|
| 242 | - |
|
| 243 | - $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
| 244 | - $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
| 245 | - $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
| 246 | - $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
| 247 | - $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
| 248 | - $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
| 249 | - $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
| 250 | - $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
| 251 | - $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
| 252 | - |
|
| 253 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 228 | + $expr[] = $search->compare('!=', 'customer.lists.id', null); |
|
| 229 | + $expr[] = $search->compare('!=', 'customer.lists.siteid', null); |
|
| 230 | + $expr[] = $search->compare('!=', 'customer.lists.parentid', null); |
|
| 231 | + $expr[] = $search->compare('==', 'customer.lists.domain', 'text'); |
|
| 232 | + $expr[] = $search->compare('>', 'customer.lists.typeid', 0); |
|
| 233 | + $expr[] = $search->compare('>', 'customer.lists.refid', 0); |
|
| 234 | + $expr[] = $search->compare('==', 'customer.lists.datestart', '2010-01-01 00:00:00'); |
|
| 235 | + $expr[] = $search->compare('==', 'customer.lists.dateend', '2100-01-01 00:00:00'); |
|
| 236 | + $expr[] = $search->compare('!=', 'customer.lists.config', null); |
|
| 237 | + $expr[] = $search->compare('>', 'customer.lists.position', 0); |
|
| 238 | + $expr[] = $search->compare('==', 'customer.lists.status', 1); |
|
| 239 | + $expr[] = $search->compare('>=', 'customer.lists.mtime', '1970-01-01 00:00:00'); |
|
| 240 | + $expr[] = $search->compare('>=', 'customer.lists.ctime', '1970-01-01 00:00:00'); |
|
| 241 | + $expr[] = $search->compare('==', 'customer.lists.editor', $this->editor); |
|
| 242 | + |
|
| 243 | + $expr[] = $search->compare('!=', 'customer.lists.type.id', 0); |
|
| 244 | + $expr[] = $search->compare('!=', 'customer.lists.type.siteid', null); |
|
| 245 | + $expr[] = $search->compare('==', 'customer.lists.type.code', 'default'); |
|
| 246 | + $expr[] = $search->compare('==', 'customer.lists.type.domain', 'text'); |
|
| 247 | + $expr[] = $search->compare('==', 'customer.lists.type.label', 'Standard'); |
|
| 248 | + $expr[] = $search->compare('==', 'customer.lists.type.status', 1); |
|
| 249 | + $expr[] = $search->compare('>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00'); |
|
| 250 | + $expr[] = $search->compare('>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00'); |
|
| 251 | + $expr[] = $search->compare('==', 'customer.lists.type.editor', $this->editor); |
|
| 252 | + |
|
| 253 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 254 | 254 | $search->setSlice(0, 2); |
| 255 | - $results = $this->object->searchItems( $search, array(), $total ); |
|
| 256 | - $this->assertEquals( 2, count( $results ) ); |
|
| 257 | - $this->assertEquals( 3, $total ); |
|
| 255 | + $results = $this->object->searchItems($search, array(), $total); |
|
| 256 | + $this->assertEquals(2, count($results)); |
|
| 257 | + $this->assertEquals(3, $total); |
|
| 258 | 258 | |
| 259 | - foreach($results as $itemId => $item) { |
|
| 260 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 259 | + foreach ($results as $itemId => $item) { |
|
| 260 | + $this->assertEquals($itemId, $item->getId()); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | public function testSearchItemsNoCriteria() |
| 266 | 266 | { |
| 267 | 267 | $search = $this->object->createSearch(); |
| 268 | - $search->setConditions( $search->compare( '==', 'customer.lists.editor', $this->editor ) ); |
|
| 269 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
| 268 | + $search->setConditions($search->compare('==', 'customer.lists.editor', $this->editor)); |
|
| 269 | + $this->assertEquals(4, count($this->object->searchItems($search))); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | |
@@ -274,48 +274,48 @@ discard block |
||
| 274 | 274 | { |
| 275 | 275 | $search = $this->object->createSearch(true); |
| 276 | 276 | $conditions = array( |
| 277 | - $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
| 277 | + $search->compare('==', 'customer.lists.editor', $this->editor), |
|
| 278 | 278 | $search->getConditions() |
| 279 | 279 | ); |
| 280 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 281 | - $this->assertEquals( 4, count( $this->object->searchItems($search) ) ); |
|
| 280 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 281 | + $this->assertEquals(4, count($this->object->searchItems($search))); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | |
| 285 | 285 | public function testGetSubManager() |
| 286 | 286 | { |
| 287 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
| 288 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
| 287 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type')); |
|
| 288 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard')); |
|
| 289 | 289 | |
| 290 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 291 | - $this->object->getSubManager( 'unknown' ); |
|
| 290 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 291 | + $this->object->getSubManager('unknown'); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | |
| 295 | 295 | protected function getListItems() |
| 296 | 296 | { |
| 297 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $this->context, 'Ezpublish' ); |
|
| 297 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context, 'Ezpublish'); |
|
| 298 | 298 | |
| 299 | 299 | $search = $manager->createSearch(); |
| 300 | - $search->setConditions( $search->compare( '==', 'customer.code', 'UTC003' ) ); |
|
| 301 | - $search->setSlice( 0, 1 ); |
|
| 300 | + $search->setConditions($search->compare('==', 'customer.code', 'UTC003')); |
|
| 301 | + $search->setSlice(0, 1); |
|
| 302 | 302 | |
| 303 | - $results = $manager->searchItems( $search ); |
|
| 303 | + $results = $manager->searchItems($search); |
|
| 304 | 304 | |
| 305 | - if( ( $item = reset( $results ) ) === false ) { |
|
| 306 | - throw new \Exception( 'No customer item found' ); |
|
| 305 | + if (($item = reset($results)) === false) { |
|
| 306 | + throw new \Exception('No customer item found'); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | $search = $this->object->createSearch(); |
| 310 | 310 | $expr = array( |
| 311 | - $search->compare( '==', 'customer.lists.parentid', $item->getId() ), |
|
| 312 | - $search->compare( '==', 'customer.lists.domain', 'text' ), |
|
| 313 | - $search->compare( '==', 'customer.lists.editor', $this->editor ), |
|
| 314 | - $search->compare( '==', 'customer.lists.type.code', 'default' ), |
|
| 311 | + $search->compare('==', 'customer.lists.parentid', $item->getId()), |
|
| 312 | + $search->compare('==', 'customer.lists.domain', 'text'), |
|
| 313 | + $search->compare('==', 'customer.lists.editor', $this->editor), |
|
| 314 | + $search->compare('==', 'customer.lists.type.code', 'default'), |
|
| 315 | 315 | ); |
| 316 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 317 | - $search->setSortations( array( $search->sort( '+', 'customer.lists.position' ) ) ); |
|
| 316 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 317 | + $search->setSortations(array($search->sort('+', 'customer.lists.position'))); |
|
| 318 | 318 | |
| 319 | - return $this->object->searchItems( $search ); |
|
| 319 | + return $this->object->searchItems($search); |
|
| 320 | 320 | } |
| 321 | 321 | } |
@@ -11,130 +11,130 @@ |
||
| 11 | 11 | |
| 12 | 12 | class EzpublishTest extends \PHPUnit_Framework_TestCase |
| 13 | 13 | { |
| 14 | - private $object; |
|
| 15 | - private $editor = ''; |
|
| 14 | + private $object; |
|
| 15 | + private $editor = ''; |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | - protected function setUp() |
|
| 19 | - { |
|
| 20 | - $this->editor = \TestHelper::getContext()->getEditor(); |
|
| 21 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'Ezpublish' ); |
|
| 18 | + protected function setUp() |
|
| 19 | + { |
|
| 20 | + $this->editor = \TestHelper::getContext()->getEditor(); |
|
| 21 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'Ezpublish' ); |
|
| 22 | 22 | |
| 23 | - $listManager = $manager->getSubManager( 'lists', 'Ezpublish' ); |
|
| 24 | - $this->object = $listManager->getSubManager( 'type', 'Ezpublish' ); |
|
| 25 | - } |
|
| 23 | + $listManager = $manager->getSubManager( 'lists', 'Ezpublish' ); |
|
| 24 | + $this->object = $listManager->getSubManager( 'type', 'Ezpublish' ); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - protected function tearDown() |
|
| 29 | - { |
|
| 30 | - unset( $this->object ); |
|
| 31 | - } |
|
| 28 | + protected function tearDown() |
|
| 29 | + { |
|
| 30 | + unset( $this->object ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - public function testCleanup() |
|
| 35 | - { |
|
| 36 | - $this->object->cleanup( array( -1 ) ); |
|
| 37 | - } |
|
| 34 | + public function testCleanup() |
|
| 35 | + { |
|
| 36 | + $this->object->cleanup( array( -1 ) ); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | - public function testCreateItem() |
|
| 41 | - { |
|
| 42 | - $item = $this->object->createItem(); |
|
| 43 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $item ); |
|
| 44 | - } |
|
| 40 | + public function testCreateItem() |
|
| 41 | + { |
|
| 42 | + $item = $this->object->createItem(); |
|
| 43 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $item ); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | - public function testGetItem() |
|
| 48 | - { |
|
| 49 | - $search = $this->object->createSearch(); |
|
| 50 | - $search->setSlice(0, 1); |
|
| 51 | - $results = $this->object->searchItems($search); |
|
| 47 | + public function testGetItem() |
|
| 48 | + { |
|
| 49 | + $search = $this->object->createSearch(); |
|
| 50 | + $search->setSlice(0, 1); |
|
| 51 | + $results = $this->object->searchItems($search); |
|
| 52 | 52 | |
| 53 | - if( ( $expected = reset($results) ) === false ) { |
|
| 54 | - throw new \Exception( 'No list type item found' ); |
|
| 55 | - } |
|
| 53 | + if( ( $expected = reset($results) ) === false ) { |
|
| 54 | + throw new \Exception( 'No list type item found' ); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - $this->assertEquals( $expected, $this->object->getItem( $expected->getId() ) ); |
|
| 58 | - } |
|
| 57 | + $this->assertEquals( $expected, $this->object->getItem( $expected->getId() ) ); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | - public function testSaveUpdateDeleteItem() |
|
| 62 | - { |
|
| 63 | - $search = $this->object->createSearch(); |
|
| 64 | - $search->setSlice(0, 1); |
|
| 65 | - $results = $this->object->searchItems($search); |
|
| 61 | + public function testSaveUpdateDeleteItem() |
|
| 62 | + { |
|
| 63 | + $search = $this->object->createSearch(); |
|
| 64 | + $search->setSlice(0, 1); |
|
| 65 | + $results = $this->object->searchItems($search); |
|
| 66 | 66 | |
| 67 | - if( ( $item = reset($results) ) === false ) { |
|
| 68 | - throw new \Exception( 'No type item found' ); |
|
| 69 | - } |
|
| 67 | + if( ( $item = reset($results) ) === false ) { |
|
| 68 | + throw new \Exception( 'No type item found' ); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - $item->setId(null); |
|
| 72 | - $item->setCode( 'unitTestInit' ); |
|
| 73 | - $this->object->saveItem( $item ); |
|
| 74 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 71 | + $item->setId(null); |
|
| 72 | + $item->setCode( 'unitTestInit' ); |
|
| 73 | + $this->object->saveItem( $item ); |
|
| 74 | + $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 75 | 75 | |
| 76 | - $itemExp = clone $itemSaved; |
|
| 77 | - $itemExp->setCode( 'unitTestSave' ); |
|
| 78 | - $this->object->saveItem( $itemExp ); |
|
| 79 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 76 | + $itemExp = clone $itemSaved; |
|
| 77 | + $itemExp->setCode( 'unitTestSave' ); |
|
| 78 | + $this->object->saveItem( $itemExp ); |
|
| 79 | + $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 80 | 80 | |
| 81 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 81 | + $this->object->deleteItem( $itemSaved->getId() ); |
|
| 82 | 82 | |
| 83 | 83 | |
| 84 | - $this->assertTrue( $item->getId() !== null ); |
|
| 85 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 86 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 87 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
| 88 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
| 89 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
| 90 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
| 84 | + $this->assertTrue( $item->getId() !== null ); |
|
| 85 | + $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 86 | + $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 87 | + $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
| 88 | + $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
| 89 | + $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
| 90 | + $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
| 91 | 91 | |
| 92 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 93 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 94 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 92 | + $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 93 | + $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 94 | + $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 95 | 95 | |
| 96 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 97 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 98 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
| 99 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
| 100 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
| 101 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
| 96 | + $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 97 | + $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 98 | + $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
| 99 | + $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
| 100 | + $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
| 101 | + $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
| 102 | 102 | |
| 103 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 104 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 105 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 103 | + $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 104 | + $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 105 | + $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 106 | 106 | |
| 107 | - $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 108 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 109 | - } |
|
| 107 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 108 | + $this->object->getItem( $itemSaved->getId() ); |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | - public function testSearchItems() |
|
| 113 | - { |
|
| 114 | - $total = 0; |
|
| 115 | - $search = $this->object->createSearch(); |
|
| 112 | + public function testSearchItems() |
|
| 113 | + { |
|
| 114 | + $total = 0; |
|
| 115 | + $search = $this->object->createSearch(); |
|
| 116 | 116 | |
| 117 | - $expr = array(); |
|
| 118 | - $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
| 119 | - $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
| 120 | - $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
| 121 | - $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
| 122 | - $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
| 123 | - $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
| 124 | - $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
| 125 | - $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
| 126 | - $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
| 127 | - |
|
| 128 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 129 | - $search->setSlice(0, 1); |
|
| 130 | - |
|
| 131 | - $results = $this->object->searchItems( $search, array(), $total ); |
|
| 132 | - $this->assertEquals( 1, count( $results ) ); |
|
| 133 | - $this->assertEquals( 1, $total ); |
|
| 134 | - |
|
| 135 | - foreach($results as $itemId => $item) { |
|
| 136 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 137 | - } |
|
| 138 | - } |
|
| 117 | + $expr = array(); |
|
| 118 | + $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
| 119 | + $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
| 120 | + $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
| 121 | + $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
| 122 | + $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
| 123 | + $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
| 124 | + $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
| 125 | + $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
| 126 | + $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
| 127 | + |
|
| 128 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 129 | + $search->setSlice(0, 1); |
|
| 130 | + |
|
| 131 | + $results = $this->object->searchItems( $search, array(), $total ); |
|
| 132 | + $this->assertEquals( 1, count( $results ) ); |
|
| 133 | + $this->assertEquals( 1, $total ); |
|
| 134 | + |
|
| 135 | + foreach($results as $itemId => $item) { |
|
| 136 | + $this->assertEquals( $itemId, $item->getId() ); |
|
| 137 | + } |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | 140 | } |
@@ -18,29 +18,29 @@ discard block |
||
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | 20 | $this->editor = \TestHelper::getContext()->getEditor(); |
| 21 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'Ezpublish' ); |
|
| 21 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'Ezpublish'); |
|
| 22 | 22 | |
| 23 | - $listManager = $manager->getSubManager( 'lists', 'Ezpublish' ); |
|
| 24 | - $this->object = $listManager->getSubManager( 'type', 'Ezpublish' ); |
|
| 23 | + $listManager = $manager->getSubManager('lists', 'Ezpublish'); |
|
| 24 | + $this->object = $listManager->getSubManager('type', 'Ezpublish'); |
|
| 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\\Type\\Iface', $item ); |
|
| 43 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Type\\Iface', $item); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | $search->setSlice(0, 1); |
| 51 | 51 | $results = $this->object->searchItems($search); |
| 52 | 52 | |
| 53 | - if( ( $expected = reset($results) ) === false ) { |
|
| 54 | - throw new \Exception( 'No list type item found' ); |
|
| 53 | + if (($expected = reset($results)) === false) { |
|
| 54 | + throw new \Exception('No list type item found'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $this->assertEquals( $expected, $this->object->getItem( $expected->getId() ) ); |
|
| 57 | + $this->assertEquals($expected, $this->object->getItem($expected->getId())); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -64,48 +64,48 @@ discard block |
||
| 64 | 64 | $search->setSlice(0, 1); |
| 65 | 65 | $results = $this->object->searchItems($search); |
| 66 | 66 | |
| 67 | - if( ( $item = reset($results) ) === false ) { |
|
| 68 | - throw new \Exception( 'No type item found' ); |
|
| 67 | + if (($item = reset($results)) === false) { |
|
| 68 | + throw new \Exception('No type item found'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $item->setId(null); |
| 72 | - $item->setCode( 'unitTestInit' ); |
|
| 73 | - $this->object->saveItem( $item ); |
|
| 74 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 72 | + $item->setCode('unitTestInit'); |
|
| 73 | + $this->object->saveItem($item); |
|
| 74 | + $itemSaved = $this->object->getItem($item->getId()); |
|
| 75 | 75 | |
| 76 | 76 | $itemExp = clone $itemSaved; |
| 77 | - $itemExp->setCode( 'unitTestSave' ); |
|
| 78 | - $this->object->saveItem( $itemExp ); |
|
| 79 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 77 | + $itemExp->setCode('unitTestSave'); |
|
| 78 | + $this->object->saveItem($itemExp); |
|
| 79 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
| 80 | 80 | |
| 81 | - $this->object->deleteItem( $itemSaved->getId() ); |
|
| 81 | + $this->object->deleteItem($itemSaved->getId()); |
|
| 82 | 82 | |
| 83 | 83 | |
| 84 | - $this->assertTrue( $item->getId() !== null ); |
|
| 85 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 86 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 87 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
| 88 | - $this->assertEquals( $item->getDomain(), $itemSaved->getDomain() ); |
|
| 89 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
| 90 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
| 84 | + $this->assertTrue($item->getId() !== null); |
|
| 85 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
| 86 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
| 87 | + $this->assertEquals($item->getCode(), $itemSaved->getCode()); |
|
| 88 | + $this->assertEquals($item->getDomain(), $itemSaved->getDomain()); |
|
| 89 | + $this->assertEquals($item->getLabel(), $itemSaved->getLabel()); |
|
| 90 | + $this->assertEquals($item->getStatus(), $itemSaved->getStatus()); |
|
| 91 | 91 | |
| 92 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 93 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 94 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 92 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 93 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 94 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
| 95 | 95 | |
| 96 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 97 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 98 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
| 99 | - $this->assertEquals( $itemExp->getDomain(), $itemUpd->getDomain() ); |
|
| 100 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
| 101 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
| 96 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 97 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
| 98 | + $this->assertEquals($itemExp->getCode(), $itemUpd->getCode()); |
|
| 99 | + $this->assertEquals($itemExp->getDomain(), $itemUpd->getDomain()); |
|
| 100 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
| 101 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
| 102 | 102 | |
| 103 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 104 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 105 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 103 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
| 104 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 105 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 106 | 106 | |
| 107 | 107 | $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
| 108 | - $this->object->getItem( $itemSaved->getId() ); |
|
| 108 | + $this->object->getItem($itemSaved->getId()); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -115,25 +115,25 @@ discard block |
||
| 115 | 115 | $search = $this->object->createSearch(); |
| 116 | 116 | |
| 117 | 117 | $expr = array(); |
| 118 | - $expr[] = $search->compare( '!=', 'customer.lists.type.id', 0 ); |
|
| 119 | - $expr[] = $search->compare( '!=', 'customer.lists.type.siteid', null ); |
|
| 120 | - $expr[] = $search->compare( '==', 'customer.lists.type.code', 'default' ); |
|
| 121 | - $expr[] = $search->compare( '==', 'customer.lists.type.domain', 'text' ); |
|
| 122 | - $expr[] = $search->compare( '==', 'customer.lists.type.label', 'Standard' ); |
|
| 123 | - $expr[] = $search->compare( '==', 'customer.lists.type.status', 1 ); |
|
| 124 | - $expr[] = $search->compare( '>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00' ); |
|
| 125 | - $expr[] = $search->compare( '>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00' ); |
|
| 126 | - $expr[] = $search->compare( '==', 'customer.lists.type.editor', $this->editor ); |
|
| 127 | - |
|
| 128 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 118 | + $expr[] = $search->compare('!=', 'customer.lists.type.id', 0); |
|
| 119 | + $expr[] = $search->compare('!=', 'customer.lists.type.siteid', null); |
|
| 120 | + $expr[] = $search->compare('==', 'customer.lists.type.code', 'default'); |
|
| 121 | + $expr[] = $search->compare('==', 'customer.lists.type.domain', 'text'); |
|
| 122 | + $expr[] = $search->compare('==', 'customer.lists.type.label', 'Standard'); |
|
| 123 | + $expr[] = $search->compare('==', 'customer.lists.type.status', 1); |
|
| 124 | + $expr[] = $search->compare('>=', 'customer.lists.type.mtime', '1970-01-01 00:00:00'); |
|
| 125 | + $expr[] = $search->compare('>=', 'customer.lists.type.ctime', '1970-01-01 00:00:00'); |
|
| 126 | + $expr[] = $search->compare('==', 'customer.lists.type.editor', $this->editor); |
|
| 127 | + |
|
| 128 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 129 | 129 | $search->setSlice(0, 1); |
| 130 | 130 | |
| 131 | - $results = $this->object->searchItems( $search, array(), $total ); |
|
| 132 | - $this->assertEquals( 1, count( $results ) ); |
|
| 133 | - $this->assertEquals( 1, $total ); |
|
| 131 | + $results = $this->object->searchItems($search, array(), $total); |
|
| 132 | + $this->assertEquals(1, count($results)); |
|
| 133 | + $this->assertEquals(1, $total); |
|
| 134 | 134 | |
| 135 | - foreach($results as $itemId => $item) { |
|
| 136 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 135 | + foreach ($results as $itemId => $item) { |
|
| 136 | + $this->assertEquals($itemId, $item->getId()); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -11,242 +11,242 @@ |
||
| 11 | 11 | |
| 12 | 12 | class EzpublishTest extends \PHPUnit_Framework_TestCase |
| 13 | 13 | { |
| 14 | - private $object; |
|
| 15 | - private $fixture; |
|
| 16 | - private $address; |
|
| 17 | - private $editor = ''; |
|
| 18 | - |
|
| 19 | - |
|
| 20 | - protected function setUp() |
|
| 21 | - { |
|
| 22 | - $context = \TestHelper::getContext(); |
|
| 23 | - $this->editor = $context->getEditor(); |
|
| 24 | - $this->object = new \Aimeos\MShop\Customer\Manager\Ezpublish( $context ); |
|
| 25 | - |
|
| 26 | - $this->fixture = array( |
|
| 27 | - 'label' => 'unitTest', |
|
| 28 | - 'status' => 2, |
|
| 29 | - ); |
|
| 30 | - |
|
| 31 | - $this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.' ); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - |
|
| 35 | - protected function tearDown() |
|
| 36 | - { |
|
| 37 | - unset( $this->object, $this->fixture, $this->address ); |
|
| 38 | - } |
|
| 14 | + private $object; |
|
| 15 | + private $fixture; |
|
| 16 | + private $address; |
|
| 17 | + private $editor = ''; |
|
| 18 | + |
|
| 19 | + |
|
| 20 | + protected function setUp() |
|
| 21 | + { |
|
| 22 | + $context = \TestHelper::getContext(); |
|
| 23 | + $this->editor = $context->getEditor(); |
|
| 24 | + $this->object = new \Aimeos\MShop\Customer\Manager\Ezpublish( $context ); |
|
| 25 | + |
|
| 26 | + $this->fixture = array( |
|
| 27 | + 'label' => 'unitTest', |
|
| 28 | + 'status' => 2, |
|
| 29 | + ); |
|
| 30 | + |
|
| 31 | + $this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.' ); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + |
|
| 35 | + protected function tearDown() |
|
| 36 | + { |
|
| 37 | + unset( $this->object, $this->fixture, $this->address ); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - public function testCleanup() |
|
| 42 | - { |
|
| 43 | - $this->object->cleanup( array( -1 ) ); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - |
|
| 47 | - public function testGetSearchAttributes() |
|
| 48 | - { |
|
| 49 | - foreach( $this->object->getSearchAttributes() as $attribute ) |
|
| 50 | - { |
|
| 51 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - |
|
| 56 | - public function testCreateItem() |
|
| 57 | - { |
|
| 58 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $this->object->createItem() ); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - public function testGetItem() |
|
| 63 | - { |
|
| 64 | - $search = $this->object->createSearch(); |
|
| 65 | - $conditions = array( |
|
| 66 | - $search->compare( '==', 'customer.code', 'UTC003' ), |
|
| 67 | - $search->compare( '==', 'customer.editor', $this->editor ) |
|
| 68 | - ); |
|
| 69 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 70 | - $items = $this->object->searchItems( $search, array( 'text' ) ); |
|
| 71 | - |
|
| 72 | - if( ( $expected = reset( $items ) ) === false ) { |
|
| 73 | - throw new \Exception( 'No customer item with code "UTC003" found' ); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - $actual = $this->object->getItem( $expected->getId(), array( 'text' ) ); |
|
| 77 | - |
|
| 78 | - $this->assertEquals( $expected, $actual ); |
|
| 79 | - $this->assertEquals( 3, count( $actual->getListItems( 'text' ) ) ); |
|
| 80 | - $this->assertEquals( 3, count( $actual->getRefItems( 'text' ) ) ); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - |
|
| 84 | - public function testSaveUpdateDeleteItem() |
|
| 85 | - { |
|
| 86 | - $item = $this->object->createItem(); |
|
| 87 | - |
|
| 88 | - $item->setCode( 'unitTest' ); |
|
| 89 | - $item->setLabel( 'unitTest' ); |
|
| 90 | - $this->object->saveItem( $item ); |
|
| 91 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 92 | - |
|
| 93 | - $itemExp = clone $itemSaved; |
|
| 94 | - $itemExp->setCode( 'unitTest2' ); |
|
| 95 | - $itemExp->setLabel( 'unitTest2' ); |
|
| 96 | - $this->object->saveItem( $itemExp ); |
|
| 97 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 98 | - |
|
| 99 | - $this->object->deleteItem( $item->getId() ); |
|
| 100 | - |
|
| 101 | - $this->assertTrue( $item->getId() !== null ); |
|
| 102 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 103 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 104 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
| 105 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
| 106 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
| 107 | - $this->assertEquals( $item->getPaymentAddress(), $itemSaved->getPaymentAddress() ); |
|
| 108 | - $this->assertEquals( $item->getBirthday(), $itemSaved->getBirthday() ); |
|
| 109 | - $this->assertEquals( $item->getPassword(), $itemSaved->getPassword() ); |
|
| 110 | - |
|
| 111 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 112 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 113 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 114 | - |
|
| 115 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 116 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 117 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
| 118 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
| 119 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
| 120 | - $this->assertEquals( $itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress() ); |
|
| 121 | - $this->assertEquals( $itemExp->getBirthday(), $itemUpd->getBirthday() ); |
|
| 122 | - $this->assertEquals( $itemExp->getPassword(), $itemUpd->getPassword() ); |
|
| 123 | - |
|
| 124 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 125 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 126 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 127 | - |
|
| 128 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 129 | - $this->object->getItem( $item->getId() ); |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - |
|
| 133 | - public function testCreateSearch() |
|
| 134 | - { |
|
| 135 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() ); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - |
|
| 139 | - public function testSearchItems() |
|
| 140 | - { |
|
| 141 | - $total = 0; |
|
| 142 | - $search = $this->object->createSearch(); |
|
| 143 | - |
|
| 144 | - $expr = array(); |
|
| 145 | - $expr[] = $search->compare( '!=', 'customer.id', null ); |
|
| 146 | - $expr[] = $search->compare( '==', 'customer.label', 'UTC002' ); |
|
| 147 | - $expr[] = $search->compare( '==', 'customer.code', 'UTC002' ); |
|
| 148 | - |
|
| 149 | - $expr[] = $search->compare( '>=', 'customer.salutation', '' ); |
|
| 150 | - $expr[] = $search->compare( '>=', 'customer.company', '' ); |
|
| 151 | - $expr[] = $search->compare( '>=', 'customer.vatid', '' ); |
|
| 152 | - $expr[] = $search->compare( '>=', 'customer.title', '' ); |
|
| 153 | - $expr[] = $search->compare( '>=', 'customer.firstname', '' ); |
|
| 154 | - $expr[] = $search->compare( '>=', 'customer.lastname', '' ); |
|
| 155 | - $expr[] = $search->compare( '>=', 'customer.address1', '' ); |
|
| 156 | - $expr[] = $search->compare( '>=', 'customer.address2', '' ); |
|
| 157 | - $expr[] = $search->compare( '>=', 'customer.address3', '' ); |
|
| 158 | - $expr[] = $search->compare( '>=', 'customer.postal', '' ); |
|
| 159 | - $expr[] = $search->compare( '>=', 'customer.city', '' ); |
|
| 160 | - $expr[] = $search->compare( '>=', 'customer.state', '' ); |
|
| 161 | - $expr[] = $search->compare( '!=', 'customer.languageid', null ); |
|
| 162 | - $expr[] = $search->compare( '>=', 'customer.countryid', '' ); |
|
| 163 | - $expr[] = $search->compare( '>=', 'customer.telephone', '' ); |
|
| 164 | - $expr[] = $search->compare( '>=', 'customer.email', '' ); |
|
| 165 | - $expr[] = $search->compare( '>=', 'customer.telefax', '' ); |
|
| 166 | - $expr[] = $search->compare( '>=', 'customer.website', '' ); |
|
| 167 | - |
|
| 168 | - $expr[] = $search->compare( '==', 'customer.birthday', '1970-01-01' ); |
|
| 169 | - $expr[] = $search->compare( '>=', 'customer.password', '' ); |
|
| 170 | - $expr[] = $search->compare( '==', 'customer.status', 0 ); |
|
| 171 | - $expr[] = $search->compare( '!=', 'customer.mtime', '1970-01-01 00:00:00' ); |
|
| 172 | - $expr[] = $search->compare( '!=', 'customer.ctime', '1970-01-01 00:00:00' ); |
|
| 173 | - $expr[] = $search->compare( '==', 'customer.editor', $this->editor ); |
|
| 174 | - |
|
| 175 | - $expr[] = $search->compare( '!=', 'customer.address.id', null ); |
|
| 176 | - $expr[] = $search->compare( '!=', 'customer.address.parentid', null ); |
|
| 177 | - $expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' ); |
|
| 178 | - $expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' ); |
|
| 179 | - $expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' ); |
|
| 180 | - $expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' ); |
|
| 181 | - $expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' ); |
|
| 182 | - $expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' ); |
|
| 183 | - $expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' ); |
|
| 184 | - $expr[] = $search->compare( '==', 'customer.address.address2', '2-4' ); |
|
| 185 | - $expr[] = $search->compare( '==', 'customer.address.address3', '' ); |
|
| 186 | - $expr[] = $search->compare( '==', 'customer.address.postal', '11099' ); |
|
| 187 | - $expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' ); |
|
| 188 | - $expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' ); |
|
| 189 | - $expr[] = $search->compare( '==', 'customer.address.languageid', 'de' ); |
|
| 190 | - $expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' ); |
|
| 191 | - $expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' ); |
|
| 192 | - $expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' ); |
|
| 193 | - $expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' ); |
|
| 194 | - $expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' ); |
|
| 195 | - $expr[] = $search->compare( '==', 'customer.address.flag', 0 ); |
|
| 196 | - $expr[] = $search->compare( '==', 'customer.address.position', 1 ); |
|
| 197 | - $expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' ); |
|
| 198 | - $expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' ); |
|
| 199 | - $expr[] = $search->compare( '==', 'customer.address.editor', $this->editor ); |
|
| 200 | - |
|
| 201 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 202 | - $result = $this->object->searchItems( $search, array(), $total ); |
|
| 203 | - $this->assertEquals( 1, count( $result ) ); |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - |
|
| 207 | - public function testSearchItemsNoCriteria() |
|
| 208 | - { |
|
| 209 | - $total = 0; |
|
| 210 | - |
|
| 211 | - $search = $this->object->createSearch(); |
|
| 212 | - $search->setConditions( $search->compare( '==', 'customer.address.editor', $this->editor ) ); |
|
| 213 | - $search->setSlice( 0, 2 ); |
|
| 214 | - |
|
| 215 | - $results = $this->object->searchItems( $search, array(), $total ); |
|
| 216 | - $this->assertEquals( 2, count( $results ) ); |
|
| 217 | - $this->assertEquals( 3, $total ); |
|
| 218 | - |
|
| 219 | - foreach($results as $itemId => $item) { |
|
| 220 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 221 | - } |
|
| 222 | - } |
|
| 223 | - |
|
| 224 | - |
|
| 225 | - public function testSearchItemsBaseCriteria() |
|
| 226 | - { |
|
| 227 | - $search = $this->object->createSearch( true ); |
|
| 228 | - $conditions = array( |
|
| 229 | - $search->compare( '==', 'customer.address.editor', $this->editor ), |
|
| 230 | - $search->getConditions() |
|
| 231 | - ); |
|
| 232 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 233 | - $this->assertEquals( 2, count( $this->object->searchItems( $search, array(), $total ) ) ); |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - |
|
| 237 | - public function testGetSubManager() |
|
| 238 | - { |
|
| 239 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address' ) ); |
|
| 240 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address', 'Standard' ) ); |
|
| 241 | - |
|
| 242 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 243 | - $this->object->getSubManager( 'unknown' ); |
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - |
|
| 247 | - public function testGetSubManagerInvalidName() |
|
| 248 | - { |
|
| 249 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 250 | - $this->object->getSubManager( 'address', 'unknown' ); |
|
| 251 | - } |
|
| 41 | + public function testCleanup() |
|
| 42 | + { |
|
| 43 | + $this->object->cleanup( array( -1 ) ); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + |
|
| 47 | + public function testGetSearchAttributes() |
|
| 48 | + { |
|
| 49 | + foreach( $this->object->getSearchAttributes() as $attribute ) |
|
| 50 | + { |
|
| 51 | + $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + |
|
| 56 | + public function testCreateItem() |
|
| 57 | + { |
|
| 58 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $this->object->createItem() ); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + public function testGetItem() |
|
| 63 | + { |
|
| 64 | + $search = $this->object->createSearch(); |
|
| 65 | + $conditions = array( |
|
| 66 | + $search->compare( '==', 'customer.code', 'UTC003' ), |
|
| 67 | + $search->compare( '==', 'customer.editor', $this->editor ) |
|
| 68 | + ); |
|
| 69 | + $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 70 | + $items = $this->object->searchItems( $search, array( 'text' ) ); |
|
| 71 | + |
|
| 72 | + if( ( $expected = reset( $items ) ) === false ) { |
|
| 73 | + throw new \Exception( 'No customer item with code "UTC003" found' ); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + $actual = $this->object->getItem( $expected->getId(), array( 'text' ) ); |
|
| 77 | + |
|
| 78 | + $this->assertEquals( $expected, $actual ); |
|
| 79 | + $this->assertEquals( 3, count( $actual->getListItems( 'text' ) ) ); |
|
| 80 | + $this->assertEquals( 3, count( $actual->getRefItems( 'text' ) ) ); |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + |
|
| 84 | + public function testSaveUpdateDeleteItem() |
|
| 85 | + { |
|
| 86 | + $item = $this->object->createItem(); |
|
| 87 | + |
|
| 88 | + $item->setCode( 'unitTest' ); |
|
| 89 | + $item->setLabel( 'unitTest' ); |
|
| 90 | + $this->object->saveItem( $item ); |
|
| 91 | + $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 92 | + |
|
| 93 | + $itemExp = clone $itemSaved; |
|
| 94 | + $itemExp->setCode( 'unitTest2' ); |
|
| 95 | + $itemExp->setLabel( 'unitTest2' ); |
|
| 96 | + $this->object->saveItem( $itemExp ); |
|
| 97 | + $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 98 | + |
|
| 99 | + $this->object->deleteItem( $item->getId() ); |
|
| 100 | + |
|
| 101 | + $this->assertTrue( $item->getId() !== null ); |
|
| 102 | + $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 103 | + $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 104 | + $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
| 105 | + $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
| 106 | + $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
| 107 | + $this->assertEquals( $item->getPaymentAddress(), $itemSaved->getPaymentAddress() ); |
|
| 108 | + $this->assertEquals( $item->getBirthday(), $itemSaved->getBirthday() ); |
|
| 109 | + $this->assertEquals( $item->getPassword(), $itemSaved->getPassword() ); |
|
| 110 | + |
|
| 111 | + $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 112 | + $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 113 | + $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 114 | + |
|
| 115 | + $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 116 | + $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 117 | + $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
| 118 | + $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
| 119 | + $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
| 120 | + $this->assertEquals( $itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress() ); |
|
| 121 | + $this->assertEquals( $itemExp->getBirthday(), $itemUpd->getBirthday() ); |
|
| 122 | + $this->assertEquals( $itemExp->getPassword(), $itemUpd->getPassword() ); |
|
| 123 | + |
|
| 124 | + $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 125 | + $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 126 | + $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 127 | + |
|
| 128 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 129 | + $this->object->getItem( $item->getId() ); |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + |
|
| 133 | + public function testCreateSearch() |
|
| 134 | + { |
|
| 135 | + $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() ); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + |
|
| 139 | + public function testSearchItems() |
|
| 140 | + { |
|
| 141 | + $total = 0; |
|
| 142 | + $search = $this->object->createSearch(); |
|
| 143 | + |
|
| 144 | + $expr = array(); |
|
| 145 | + $expr[] = $search->compare( '!=', 'customer.id', null ); |
|
| 146 | + $expr[] = $search->compare( '==', 'customer.label', 'UTC002' ); |
|
| 147 | + $expr[] = $search->compare( '==', 'customer.code', 'UTC002' ); |
|
| 148 | + |
|
| 149 | + $expr[] = $search->compare( '>=', 'customer.salutation', '' ); |
|
| 150 | + $expr[] = $search->compare( '>=', 'customer.company', '' ); |
|
| 151 | + $expr[] = $search->compare( '>=', 'customer.vatid', '' ); |
|
| 152 | + $expr[] = $search->compare( '>=', 'customer.title', '' ); |
|
| 153 | + $expr[] = $search->compare( '>=', 'customer.firstname', '' ); |
|
| 154 | + $expr[] = $search->compare( '>=', 'customer.lastname', '' ); |
|
| 155 | + $expr[] = $search->compare( '>=', 'customer.address1', '' ); |
|
| 156 | + $expr[] = $search->compare( '>=', 'customer.address2', '' ); |
|
| 157 | + $expr[] = $search->compare( '>=', 'customer.address3', '' ); |
|
| 158 | + $expr[] = $search->compare( '>=', 'customer.postal', '' ); |
|
| 159 | + $expr[] = $search->compare( '>=', 'customer.city', '' ); |
|
| 160 | + $expr[] = $search->compare( '>=', 'customer.state', '' ); |
|
| 161 | + $expr[] = $search->compare( '!=', 'customer.languageid', null ); |
|
| 162 | + $expr[] = $search->compare( '>=', 'customer.countryid', '' ); |
|
| 163 | + $expr[] = $search->compare( '>=', 'customer.telephone', '' ); |
|
| 164 | + $expr[] = $search->compare( '>=', 'customer.email', '' ); |
|
| 165 | + $expr[] = $search->compare( '>=', 'customer.telefax', '' ); |
|
| 166 | + $expr[] = $search->compare( '>=', 'customer.website', '' ); |
|
| 167 | + |
|
| 168 | + $expr[] = $search->compare( '==', 'customer.birthday', '1970-01-01' ); |
|
| 169 | + $expr[] = $search->compare( '>=', 'customer.password', '' ); |
|
| 170 | + $expr[] = $search->compare( '==', 'customer.status', 0 ); |
|
| 171 | + $expr[] = $search->compare( '!=', 'customer.mtime', '1970-01-01 00:00:00' ); |
|
| 172 | + $expr[] = $search->compare( '!=', 'customer.ctime', '1970-01-01 00:00:00' ); |
|
| 173 | + $expr[] = $search->compare( '==', 'customer.editor', $this->editor ); |
|
| 174 | + |
|
| 175 | + $expr[] = $search->compare( '!=', 'customer.address.id', null ); |
|
| 176 | + $expr[] = $search->compare( '!=', 'customer.address.parentid', null ); |
|
| 177 | + $expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' ); |
|
| 178 | + $expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' ); |
|
| 179 | + $expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' ); |
|
| 180 | + $expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' ); |
|
| 181 | + $expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' ); |
|
| 182 | + $expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' ); |
|
| 183 | + $expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' ); |
|
| 184 | + $expr[] = $search->compare( '==', 'customer.address.address2', '2-4' ); |
|
| 185 | + $expr[] = $search->compare( '==', 'customer.address.address3', '' ); |
|
| 186 | + $expr[] = $search->compare( '==', 'customer.address.postal', '11099' ); |
|
| 187 | + $expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' ); |
|
| 188 | + $expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' ); |
|
| 189 | + $expr[] = $search->compare( '==', 'customer.address.languageid', 'de' ); |
|
| 190 | + $expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' ); |
|
| 191 | + $expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' ); |
|
| 192 | + $expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' ); |
|
| 193 | + $expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' ); |
|
| 194 | + $expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' ); |
|
| 195 | + $expr[] = $search->compare( '==', 'customer.address.flag', 0 ); |
|
| 196 | + $expr[] = $search->compare( '==', 'customer.address.position', 1 ); |
|
| 197 | + $expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' ); |
|
| 198 | + $expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' ); |
|
| 199 | + $expr[] = $search->compare( '==', 'customer.address.editor', $this->editor ); |
|
| 200 | + |
|
| 201 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 202 | + $result = $this->object->searchItems( $search, array(), $total ); |
|
| 203 | + $this->assertEquals( 1, count( $result ) ); |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + |
|
| 207 | + public function testSearchItemsNoCriteria() |
|
| 208 | + { |
|
| 209 | + $total = 0; |
|
| 210 | + |
|
| 211 | + $search = $this->object->createSearch(); |
|
| 212 | + $search->setConditions( $search->compare( '==', 'customer.address.editor', $this->editor ) ); |
|
| 213 | + $search->setSlice( 0, 2 ); |
|
| 214 | + |
|
| 215 | + $results = $this->object->searchItems( $search, array(), $total ); |
|
| 216 | + $this->assertEquals( 2, count( $results ) ); |
|
| 217 | + $this->assertEquals( 3, $total ); |
|
| 218 | + |
|
| 219 | + foreach($results as $itemId => $item) { |
|
| 220 | + $this->assertEquals( $itemId, $item->getId() ); |
|
| 221 | + } |
|
| 222 | + } |
|
| 223 | + |
|
| 224 | + |
|
| 225 | + public function testSearchItemsBaseCriteria() |
|
| 226 | + { |
|
| 227 | + $search = $this->object->createSearch( true ); |
|
| 228 | + $conditions = array( |
|
| 229 | + $search->compare( '==', 'customer.address.editor', $this->editor ), |
|
| 230 | + $search->getConditions() |
|
| 231 | + ); |
|
| 232 | + $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 233 | + $this->assertEquals( 2, count( $this->object->searchItems( $search, array(), $total ) ) ); |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + |
|
| 237 | + public function testGetSubManager() |
|
| 238 | + { |
|
| 239 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address' ) ); |
|
| 240 | + $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address', 'Standard' ) ); |
|
| 241 | + |
|
| 242 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 243 | + $this->object->getSubManager( 'unknown' ); |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + |
|
| 247 | + public function testGetSubManagerInvalidName() |
|
| 248 | + { |
|
| 249 | + $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 250 | + $this->object->getSubManager( 'address', 'unknown' ); |
|
| 251 | + } |
|
| 252 | 252 | } |
@@ -21,41 +21,41 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | $context = \TestHelper::getContext(); |
| 23 | 23 | $this->editor = $context->getEditor(); |
| 24 | - $this->object = new \Aimeos\MShop\Customer\Manager\Ezpublish( $context ); |
|
| 24 | + $this->object = new \Aimeos\MShop\Customer\Manager\Ezpublish($context); |
|
| 25 | 25 | |
| 26 | 26 | $this->fixture = array( |
| 27 | 27 | 'label' => 'unitTest', |
| 28 | 28 | 'status' => 2, |
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | - $this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.' ); |
|
| 31 | + $this->address = new \Aimeos\MShop\Common\Item\Address\Standard('common.address.'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | protected function tearDown() |
| 36 | 36 | { |
| 37 | - unset( $this->object, $this->fixture, $this->address ); |
|
| 37 | + unset($this->object, $this->fixture, $this->address); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | public function testCleanup() |
| 42 | 42 | { |
| 43 | - $this->object->cleanup( array( -1 ) ); |
|
| 43 | + $this->object->cleanup(array( -1 )); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | public function testGetSearchAttributes() |
| 48 | 48 | { |
| 49 | - foreach( $this->object->getSearchAttributes() as $attribute ) |
|
| 49 | + foreach ($this->object->getSearchAttributes() as $attribute) |
|
| 50 | 50 | { |
| 51 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute ); |
|
| 51 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | public function testCreateItem() |
| 57 | 57 | { |
| 58 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $this->object->createItem() ); |
|
| 58 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Customer\\Item\\Iface', $this->object->createItem()); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -63,21 +63,21 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $search = $this->object->createSearch(); |
| 65 | 65 | $conditions = array( |
| 66 | - $search->compare( '==', 'customer.code', 'UTC003' ), |
|
| 67 | - $search->compare( '==', 'customer.editor', $this->editor ) |
|
| 66 | + $search->compare('==', 'customer.code', 'UTC003'), |
|
| 67 | + $search->compare('==', 'customer.editor', $this->editor) |
|
| 68 | 68 | ); |
| 69 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 70 | - $items = $this->object->searchItems( $search, array( 'text' ) ); |
|
| 69 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 70 | + $items = $this->object->searchItems($search, array('text')); |
|
| 71 | 71 | |
| 72 | - if( ( $expected = reset( $items ) ) === false ) { |
|
| 73 | - throw new \Exception( 'No customer item with code "UTC003" found' ); |
|
| 72 | + if (($expected = reset($items)) === false) { |
|
| 73 | + throw new \Exception('No customer item with code "UTC003" found'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $actual = $this->object->getItem( $expected->getId(), array( 'text' ) ); |
|
| 76 | + $actual = $this->object->getItem($expected->getId(), array('text')); |
|
| 77 | 77 | |
| 78 | - $this->assertEquals( $expected, $actual ); |
|
| 79 | - $this->assertEquals( 3, count( $actual->getListItems( 'text' ) ) ); |
|
| 80 | - $this->assertEquals( 3, count( $actual->getRefItems( 'text' ) ) ); |
|
| 78 | + $this->assertEquals($expected, $actual); |
|
| 79 | + $this->assertEquals(3, count($actual->getListItems('text'))); |
|
| 80 | + $this->assertEquals(3, count($actual->getRefItems('text'))); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
@@ -85,54 +85,54 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $item = $this->object->createItem(); |
| 87 | 87 | |
| 88 | - $item->setCode( 'unitTest' ); |
|
| 89 | - $item->setLabel( 'unitTest' ); |
|
| 90 | - $this->object->saveItem( $item ); |
|
| 91 | - $itemSaved = $this->object->getItem( $item->getId() ); |
|
| 88 | + $item->setCode('unitTest'); |
|
| 89 | + $item->setLabel('unitTest'); |
|
| 90 | + $this->object->saveItem($item); |
|
| 91 | + $itemSaved = $this->object->getItem($item->getId()); |
|
| 92 | 92 | |
| 93 | 93 | $itemExp = clone $itemSaved; |
| 94 | - $itemExp->setCode( 'unitTest2' ); |
|
| 95 | - $itemExp->setLabel( 'unitTest2' ); |
|
| 96 | - $this->object->saveItem( $itemExp ); |
|
| 97 | - $itemUpd = $this->object->getItem( $itemExp->getId() ); |
|
| 98 | - |
|
| 99 | - $this->object->deleteItem( $item->getId() ); |
|
| 100 | - |
|
| 101 | - $this->assertTrue( $item->getId() !== null ); |
|
| 102 | - $this->assertEquals( $item->getId(), $itemSaved->getId() ); |
|
| 103 | - $this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() ); |
|
| 104 | - $this->assertEquals( $item->getStatus(), $itemSaved->getStatus() ); |
|
| 105 | - $this->assertEquals( $item->getCode(), $itemSaved->getCode() ); |
|
| 106 | - $this->assertEquals( $item->getLabel(), $itemSaved->getLabel() ); |
|
| 107 | - $this->assertEquals( $item->getPaymentAddress(), $itemSaved->getPaymentAddress() ); |
|
| 108 | - $this->assertEquals( $item->getBirthday(), $itemSaved->getBirthday() ); |
|
| 109 | - $this->assertEquals( $item->getPassword(), $itemSaved->getPassword() ); |
|
| 110 | - |
|
| 111 | - $this->assertEquals( $this->editor, $itemSaved->getEditor() ); |
|
| 112 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() ); |
|
| 113 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() ); |
|
| 114 | - |
|
| 115 | - $this->assertEquals( $itemExp->getId(), $itemUpd->getId() ); |
|
| 116 | - $this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() ); |
|
| 117 | - $this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() ); |
|
| 118 | - $this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() ); |
|
| 119 | - $this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() ); |
|
| 120 | - $this->assertEquals( $itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress() ); |
|
| 121 | - $this->assertEquals( $itemExp->getBirthday(), $itemUpd->getBirthday() ); |
|
| 122 | - $this->assertEquals( $itemExp->getPassword(), $itemUpd->getPassword() ); |
|
| 123 | - |
|
| 124 | - $this->assertEquals( $this->editor, $itemUpd->getEditor() ); |
|
| 125 | - $this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() ); |
|
| 126 | - $this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() ); |
|
| 127 | - |
|
| 128 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 129 | - $this->object->getItem( $item->getId() ); |
|
| 94 | + $itemExp->setCode('unitTest2'); |
|
| 95 | + $itemExp->setLabel('unitTest2'); |
|
| 96 | + $this->object->saveItem($itemExp); |
|
| 97 | + $itemUpd = $this->object->getItem($itemExp->getId()); |
|
| 98 | + |
|
| 99 | + $this->object->deleteItem($item->getId()); |
|
| 100 | + |
|
| 101 | + $this->assertTrue($item->getId() !== null); |
|
| 102 | + $this->assertEquals($item->getId(), $itemSaved->getId()); |
|
| 103 | + $this->assertEquals($item->getSiteId(), $itemSaved->getSiteId()); |
|
| 104 | + $this->assertEquals($item->getStatus(), $itemSaved->getStatus()); |
|
| 105 | + $this->assertEquals($item->getCode(), $itemSaved->getCode()); |
|
| 106 | + $this->assertEquals($item->getLabel(), $itemSaved->getLabel()); |
|
| 107 | + $this->assertEquals($item->getPaymentAddress(), $itemSaved->getPaymentAddress()); |
|
| 108 | + $this->assertEquals($item->getBirthday(), $itemSaved->getBirthday()); |
|
| 109 | + $this->assertEquals($item->getPassword(), $itemSaved->getPassword()); |
|
| 110 | + |
|
| 111 | + $this->assertEquals($this->editor, $itemSaved->getEditor()); |
|
| 112 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated()); |
|
| 113 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified()); |
|
| 114 | + |
|
| 115 | + $this->assertEquals($itemExp->getId(), $itemUpd->getId()); |
|
| 116 | + $this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId()); |
|
| 117 | + $this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus()); |
|
| 118 | + $this->assertEquals($itemExp->getCode(), $itemUpd->getCode()); |
|
| 119 | + $this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel()); |
|
| 120 | + $this->assertEquals($itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress()); |
|
| 121 | + $this->assertEquals($itemExp->getBirthday(), $itemUpd->getBirthday()); |
|
| 122 | + $this->assertEquals($itemExp->getPassword(), $itemUpd->getPassword()); |
|
| 123 | + |
|
| 124 | + $this->assertEquals($this->editor, $itemUpd->getEditor()); |
|
| 125 | + $this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated()); |
|
| 126 | + $this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified()); |
|
| 127 | + |
|
| 128 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 129 | + $this->object->getItem($item->getId()); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | public function testCreateSearch() |
| 134 | 134 | { |
| 135 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() ); |
|
| 135 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch()); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
@@ -142,65 +142,65 @@ discard block |
||
| 142 | 142 | $search = $this->object->createSearch(); |
| 143 | 143 | |
| 144 | 144 | $expr = array(); |
| 145 | - $expr[] = $search->compare( '!=', 'customer.id', null ); |
|
| 146 | - $expr[] = $search->compare( '==', 'customer.label', 'UTC002' ); |
|
| 147 | - $expr[] = $search->compare( '==', 'customer.code', 'UTC002' ); |
|
| 148 | - |
|
| 149 | - $expr[] = $search->compare( '>=', 'customer.salutation', '' ); |
|
| 150 | - $expr[] = $search->compare( '>=', 'customer.company', '' ); |
|
| 151 | - $expr[] = $search->compare( '>=', 'customer.vatid', '' ); |
|
| 152 | - $expr[] = $search->compare( '>=', 'customer.title', '' ); |
|
| 153 | - $expr[] = $search->compare( '>=', 'customer.firstname', '' ); |
|
| 154 | - $expr[] = $search->compare( '>=', 'customer.lastname', '' ); |
|
| 155 | - $expr[] = $search->compare( '>=', 'customer.address1', '' ); |
|
| 156 | - $expr[] = $search->compare( '>=', 'customer.address2', '' ); |
|
| 157 | - $expr[] = $search->compare( '>=', 'customer.address3', '' ); |
|
| 158 | - $expr[] = $search->compare( '>=', 'customer.postal', '' ); |
|
| 159 | - $expr[] = $search->compare( '>=', 'customer.city', '' ); |
|
| 160 | - $expr[] = $search->compare( '>=', 'customer.state', '' ); |
|
| 161 | - $expr[] = $search->compare( '!=', 'customer.languageid', null ); |
|
| 162 | - $expr[] = $search->compare( '>=', 'customer.countryid', '' ); |
|
| 163 | - $expr[] = $search->compare( '>=', 'customer.telephone', '' ); |
|
| 164 | - $expr[] = $search->compare( '>=', 'customer.email', '' ); |
|
| 165 | - $expr[] = $search->compare( '>=', 'customer.telefax', '' ); |
|
| 166 | - $expr[] = $search->compare( '>=', 'customer.website', '' ); |
|
| 167 | - |
|
| 168 | - $expr[] = $search->compare( '==', 'customer.birthday', '1970-01-01' ); |
|
| 169 | - $expr[] = $search->compare( '>=', 'customer.password', '' ); |
|
| 170 | - $expr[] = $search->compare( '==', 'customer.status', 0 ); |
|
| 171 | - $expr[] = $search->compare( '!=', 'customer.mtime', '1970-01-01 00:00:00' ); |
|
| 172 | - $expr[] = $search->compare( '!=', 'customer.ctime', '1970-01-01 00:00:00' ); |
|
| 173 | - $expr[] = $search->compare( '==', 'customer.editor', $this->editor ); |
|
| 174 | - |
|
| 175 | - $expr[] = $search->compare( '!=', 'customer.address.id', null ); |
|
| 176 | - $expr[] = $search->compare( '!=', 'customer.address.parentid', null ); |
|
| 177 | - $expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' ); |
|
| 178 | - $expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' ); |
|
| 179 | - $expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' ); |
|
| 180 | - $expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' ); |
|
| 181 | - $expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' ); |
|
| 182 | - $expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' ); |
|
| 183 | - $expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' ); |
|
| 184 | - $expr[] = $search->compare( '==', 'customer.address.address2', '2-4' ); |
|
| 185 | - $expr[] = $search->compare( '==', 'customer.address.address3', '' ); |
|
| 186 | - $expr[] = $search->compare( '==', 'customer.address.postal', '11099' ); |
|
| 187 | - $expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' ); |
|
| 188 | - $expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' ); |
|
| 189 | - $expr[] = $search->compare( '==', 'customer.address.languageid', 'de' ); |
|
| 190 | - $expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' ); |
|
| 191 | - $expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' ); |
|
| 192 | - $expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' ); |
|
| 193 | - $expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' ); |
|
| 194 | - $expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' ); |
|
| 195 | - $expr[] = $search->compare( '==', 'customer.address.flag', 0 ); |
|
| 196 | - $expr[] = $search->compare( '==', 'customer.address.position', 1 ); |
|
| 197 | - $expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' ); |
|
| 198 | - $expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' ); |
|
| 199 | - $expr[] = $search->compare( '==', 'customer.address.editor', $this->editor ); |
|
| 200 | - |
|
| 201 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 202 | - $result = $this->object->searchItems( $search, array(), $total ); |
|
| 203 | - $this->assertEquals( 1, count( $result ) ); |
|
| 145 | + $expr[] = $search->compare('!=', 'customer.id', null); |
|
| 146 | + $expr[] = $search->compare('==', 'customer.label', 'UTC002'); |
|
| 147 | + $expr[] = $search->compare('==', 'customer.code', 'UTC002'); |
|
| 148 | + |
|
| 149 | + $expr[] = $search->compare('>=', 'customer.salutation', ''); |
|
| 150 | + $expr[] = $search->compare('>=', 'customer.company', ''); |
|
| 151 | + $expr[] = $search->compare('>=', 'customer.vatid', ''); |
|
| 152 | + $expr[] = $search->compare('>=', 'customer.title', ''); |
|
| 153 | + $expr[] = $search->compare('>=', 'customer.firstname', ''); |
|
| 154 | + $expr[] = $search->compare('>=', 'customer.lastname', ''); |
|
| 155 | + $expr[] = $search->compare('>=', 'customer.address1', ''); |
|
| 156 | + $expr[] = $search->compare('>=', 'customer.address2', ''); |
|
| 157 | + $expr[] = $search->compare('>=', 'customer.address3', ''); |
|
| 158 | + $expr[] = $search->compare('>=', 'customer.postal', ''); |
|
| 159 | + $expr[] = $search->compare('>=', 'customer.city', ''); |
|
| 160 | + $expr[] = $search->compare('>=', 'customer.state', ''); |
|
| 161 | + $expr[] = $search->compare('!=', 'customer.languageid', null); |
|
| 162 | + $expr[] = $search->compare('>=', 'customer.countryid', ''); |
|
| 163 | + $expr[] = $search->compare('>=', 'customer.telephone', ''); |
|
| 164 | + $expr[] = $search->compare('>=', 'customer.email', ''); |
|
| 165 | + $expr[] = $search->compare('>=', 'customer.telefax', ''); |
|
| 166 | + $expr[] = $search->compare('>=', 'customer.website', ''); |
|
| 167 | + |
|
| 168 | + $expr[] = $search->compare('==', 'customer.birthday', '1970-01-01'); |
|
| 169 | + $expr[] = $search->compare('>=', 'customer.password', ''); |
|
| 170 | + $expr[] = $search->compare('==', 'customer.status', 0); |
|
| 171 | + $expr[] = $search->compare('!=', 'customer.mtime', '1970-01-01 00:00:00'); |
|
| 172 | + $expr[] = $search->compare('!=', 'customer.ctime', '1970-01-01 00:00:00'); |
|
| 173 | + $expr[] = $search->compare('==', 'customer.editor', $this->editor); |
|
| 174 | + |
|
| 175 | + $expr[] = $search->compare('!=', 'customer.address.id', null); |
|
| 176 | + $expr[] = $search->compare('!=', 'customer.address.parentid', null); |
|
| 177 | + $expr[] = $search->compare('==', 'customer.address.company', 'ABC GmbH'); |
|
| 178 | + $expr[] = $search->compare('==', 'customer.address.vatid', 'DE999999999'); |
|
| 179 | + $expr[] = $search->compare('==', 'customer.address.salutation', 'mr'); |
|
| 180 | + $expr[] = $search->compare('==', 'customer.address.title', 'Dr.'); |
|
| 181 | + $expr[] = $search->compare('==', 'customer.address.firstname', 'Good'); |
|
| 182 | + $expr[] = $search->compare('==', 'customer.address.lastname', 'Unittest'); |
|
| 183 | + $expr[] = $search->compare('==', 'customer.address.address1', 'Pickhuben'); |
|
| 184 | + $expr[] = $search->compare('==', 'customer.address.address2', '2-4'); |
|
| 185 | + $expr[] = $search->compare('==', 'customer.address.address3', ''); |
|
| 186 | + $expr[] = $search->compare('==', 'customer.address.postal', '11099'); |
|
| 187 | + $expr[] = $search->compare('==', 'customer.address.city', 'Berlin'); |
|
| 188 | + $expr[] = $search->compare('==', 'customer.address.state', 'Berlin'); |
|
| 189 | + $expr[] = $search->compare('==', 'customer.address.languageid', 'de'); |
|
| 190 | + $expr[] = $search->compare('==', 'customer.address.countryid', 'DE'); |
|
| 191 | + $expr[] = $search->compare('==', 'customer.address.telephone', '055544332221'); |
|
| 192 | + $expr[] = $search->compare('==', 'customer.address.email', '[email protected]'); |
|
| 193 | + $expr[] = $search->compare('==', 'customer.address.telefax', '055544333212'); |
|
| 194 | + $expr[] = $search->compare('==', 'customer.address.website', 'unittest.aimeos.org'); |
|
| 195 | + $expr[] = $search->compare('==', 'customer.address.flag', 0); |
|
| 196 | + $expr[] = $search->compare('==', 'customer.address.position', 1); |
|
| 197 | + $expr[] = $search->compare('!=', 'customer.address.mtime', '1970-01-01 00:00:00'); |
|
| 198 | + $expr[] = $search->compare('!=', 'customer.address.ctime', '1970-01-01 00:00:00'); |
|
| 199 | + $expr[] = $search->compare('==', 'customer.address.editor', $this->editor); |
|
| 200 | + |
|
| 201 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 202 | + $result = $this->object->searchItems($search, array(), $total); |
|
| 203 | + $this->assertEquals(1, count($result)); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
@@ -209,44 +209,44 @@ discard block |
||
| 209 | 209 | $total = 0; |
| 210 | 210 | |
| 211 | 211 | $search = $this->object->createSearch(); |
| 212 | - $search->setConditions( $search->compare( '==', 'customer.address.editor', $this->editor ) ); |
|
| 213 | - $search->setSlice( 0, 2 ); |
|
| 212 | + $search->setConditions($search->compare('==', 'customer.address.editor', $this->editor)); |
|
| 213 | + $search->setSlice(0, 2); |
|
| 214 | 214 | |
| 215 | - $results = $this->object->searchItems( $search, array(), $total ); |
|
| 216 | - $this->assertEquals( 2, count( $results ) ); |
|
| 217 | - $this->assertEquals( 3, $total ); |
|
| 215 | + $results = $this->object->searchItems($search, array(), $total); |
|
| 216 | + $this->assertEquals(2, count($results)); |
|
| 217 | + $this->assertEquals(3, $total); |
|
| 218 | 218 | |
| 219 | - foreach($results as $itemId => $item) { |
|
| 220 | - $this->assertEquals( $itemId, $item->getId() ); |
|
| 219 | + foreach ($results as $itemId => $item) { |
|
| 220 | + $this->assertEquals($itemId, $item->getId()); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | |
| 225 | 225 | public function testSearchItemsBaseCriteria() |
| 226 | 226 | { |
| 227 | - $search = $this->object->createSearch( true ); |
|
| 227 | + $search = $this->object->createSearch(true); |
|
| 228 | 228 | $conditions = array( |
| 229 | - $search->compare( '==', 'customer.address.editor', $this->editor ), |
|
| 229 | + $search->compare('==', 'customer.address.editor', $this->editor), |
|
| 230 | 230 | $search->getConditions() |
| 231 | 231 | ); |
| 232 | - $search->setConditions( $search->combine( '&&', $conditions ) ); |
|
| 233 | - $this->assertEquals( 2, count( $this->object->searchItems( $search, array(), $total ) ) ); |
|
| 232 | + $search->setConditions($search->combine('&&', $conditions)); |
|
| 233 | + $this->assertEquals(2, count($this->object->searchItems($search, array(), $total))); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
| 237 | 237 | public function testGetSubManager() |
| 238 | 238 | { |
| 239 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address' ) ); |
|
| 240 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address', 'Standard' ) ); |
|
| 239 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address')); |
|
| 240 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address', 'Standard')); |
|
| 241 | 241 | |
| 242 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 243 | - $this->object->getSubManager( 'unknown' ); |
|
| 242 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 243 | + $this->object->getSubManager('unknown'); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
| 247 | 247 | public function testGetSubManagerInvalidName() |
| 248 | 248 | { |
| 249 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 250 | - $this->object->getSubManager( 'address', 'unknown' ); |
|
| 249 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 250 | + $this->object->getSubManager('address', 'unknown'); |
|
| 251 | 251 | } |
| 252 | 252 | } |