Completed
Push — master ( ac66b3...ab3b6f )
by Aimeos
07:35 queued 01:23
created
lib/custom/setup/unittest/CustomerListAddEzpublishTestData.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -13,48 +13,48 @@
 block discarded – undo
13 13
  * Adds customer list test data.
14 14
  */
15 15
 class CustomerListAddEzpublishTestData
16
-	extends \Aimeos\MW\Setup\Task\CustomerListAddTestData
16
+    extends \Aimeos\MW\Setup\Task\CustomerListAddTestData
17 17
 {
18
-	/**
19
-	 * Returns the list of task names which this task depends on.
20
-	 *
21
-	 * @return string[] List of task names
22
-	 */
23
-	public function getPreDependencies()
24
-	{
25
-		return array( 'TablesCreateEzpublish', 'CustomerAddEzpublishTestData', 'LocaleAddTestData', 'TextAddTestData' );
26
-	}
27
-
28
-
29
-	/**
30
-	 * Adds attribute test data.
31
-	 */
32
-	public function migrate()
33
-	{
34
-		$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
35
-		if( !( $this->additional instanceof $iface ) ) {
36
-			throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
37
-		}
38
-
39
-		$this->msg( 'Adding customer-list ezPublish test data', 0 );
40
-		$this->additional->setEditor( 'ai-ezpublish:unittest' );
41
-
42
-		$ds = DIRECTORY_SEPARATOR;
43
-		$path = dirname( __FILE__ ) . $ds . 'data' . $ds . 'customer-list.php';
44
-
45
-		if( ( $testdata = include( $path ) ) === false ){
46
-			throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer list domain', $path ) );
47
-		}
48
-
49
-		$refKeys = array();
50
-		foreach( $testdata['customer/lists'] as $dataset ) {
51
-			$refKeys[ $dataset['domain'] ][] = $dataset['refid'];
52
-		}
53
-
54
-		$refIds = array();
55
-		$refIds['text'] = $this->getTextData( $refKeys['text'] );
56
-		$this->addCustomerListData( $testdata, $refIds, 'Ezpublish' );
57
-
58
-		$this->status( 'done' );
59
-	}
18
+    /**
19
+     * Returns the list of task names which this task depends on.
20
+     *
21
+     * @return string[] List of task names
22
+     */
23
+    public function getPreDependencies()
24
+    {
25
+        return array( 'TablesCreateEzpublish', 'CustomerAddEzpublishTestData', 'LocaleAddTestData', 'TextAddTestData' );
26
+    }
27
+
28
+
29
+    /**
30
+     * Adds attribute test data.
31
+     */
32
+    public function migrate()
33
+    {
34
+        $iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
35
+        if( !( $this->additional instanceof $iface ) ) {
36
+            throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
37
+        }
38
+
39
+        $this->msg( 'Adding customer-list ezPublish test data', 0 );
40
+        $this->additional->setEditor( 'ai-ezpublish:unittest' );
41
+
42
+        $ds = DIRECTORY_SEPARATOR;
43
+        $path = dirname( __FILE__ ) . $ds . 'data' . $ds . 'customer-list.php';
44
+
45
+        if( ( $testdata = include( $path ) ) === false ){
46
+            throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer list domain', $path ) );
47
+        }
48
+
49
+        $refKeys = array();
50
+        foreach( $testdata['customer/lists'] as $dataset ) {
51
+            $refKeys[ $dataset['domain'] ][] = $dataset['refid'];
52
+        }
53
+
54
+        $refIds = array();
55
+        $refIds['text'] = $this->getTextData( $refKeys['text'] );
56
+        $this->addCustomerListData( $testdata, $refIds, 'Ezpublish' );
57
+
58
+        $this->status( 'done' );
59
+    }
60 60
 }
Please login to merge, or discard this patch.
lib/custom/setup/unittest/data/customer.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 return array (
9
-	'customer' => array(
10
-		'customer/UTC001' => array( 'code' => 'UTC001', 'label' => 'unitCustomer1', 'salutation' => 'mr', 'company' => 'ABC GmbH', 'vatid' => 'DE999999999', 'title' => 'Dr.', 'firstname' => 'Max', 'lastname' => 'Mustermann', 'address1' => 'Musterstraße', 'address2' => '1a', 'address3' => '', 'postal' => '20001', 'city' => 'Musterstadt', 'state' => 'Hamburg', 'langid' => 'de', 'countryid' => 'DE', 'telephone' => '01234567890', 'email' => '[email protected]', 'telefax' => '01234567890', 'website' => 'unittest.aimeos.org', 'birthday' => '1970-01-01', 'status' => '1', 'password' => 'test' ),
11
-		'customer/UTC002' => array( 'code' => 'UTC002', 'label' => 'unitCustomer2', 'salutation' => 'mrs', 'company' => 'ABC GmbH', 'vatid' => 'DE999999999', 'title' => 'Prof. Dr.', 'firstname' => 'Erika', 'lastname' => 'Mustermann', 'address1' => 'Heidestraße', 'address2' => '17', 'address3' => '', 'postal' => '45632', 'city' => 'Köln', 'state' => '', 'langid' => 'de', 'countryid' => 'DE', 'telephone' => '09876543210', 'email' => '[email protected]', 'telefax' => '09876543210', 'website' => 'unittest.aimeos.org', 'birthday' => '1970-01-01', 'status' => '0','password' =>  'test' ),
12
-		'customer/UTC003' => array( 'code' => 'UTC003', 'label' => 'unitCustomer3', 'salutation' => 'mr', 'company' => 'ABC GmbH', 'vatid' => 'DE999999999', 'title' => '', 'firstname' => 'Franz-Xaver', 'lastname' => 'Gabler', 'address1' => 'Phantasiestraße', 'address2' => '2', 'address3' => '', 'postal' => '23643', 'city' => 'Berlin', 'state' => 'Berlin', 'langid' => 'de', 'countryid' => 'DE', 'telephone' => '01234509876', 'email' => '[email protected]', 'telefax' => '055544333212', 'website' => 'unittest.aimeos.org', 'birthday' => '1970-01-01', 'status' => '1', 'password' => 'test' ),
13
-	),
14
-	'customer/address' => array(
15
-		array ( 'parentid' => 'customer/UTC001', 'company' => 'ABC', 'vatid' => 'DE999999999', 'salutation' => 'mr', 'title' => 'Dr', 'firstname' => 'Our', 'lastname' => 'Unittest', 'address1' => 'Pickhuben', 'address2' => '2-4', 'address3' => '', 'postal' => '20457', 'city' => 'Hamburg', 'state' => 'Hamburg', 'countryid' => 'DE', 'langid' => 'de', 'telephone' => '055544332211', 'email' => '[email protected]', 'telefax' => '055544332212', 'website' => 'unittest.aimeos.org', 'flag' => 0, 'pos' => '0' ),
16
-		array ( 'parentid' => 'customer/UTC002', 'company' => 'ABC GmbH', 'vatid' => 'DE999999999', 'salutation' => 'mr', 'title' => 'Dr.', 'firstname' => 'Good', 'lastname' => 'Unittest', 'address1' => 'Pickhuben', 'address2' => '2-4', 'address3' => '', 'postal' => '20457', 'city' => 'Hamburg', 'state' => 'Hamburg', 'countryid' => 'DE', 'langid' => 'de', 'telephone' => '055544332211', 'email' => '[email protected]', 'telefax' => '055544332212', 'website' => 'unittest.aimeos.org', 'flag' => 0, 'pos' => '1' ),
17
-		array ( 'parentid' => 'customer/UTC002', 'company' => 'ABC GmbH', 'vatid' => 'DE999999999', 'salutation' => 'mr', 'title' => 'Dr.', 'firstname' => 'Good', 'lastname' => 'Unittest', 'address1' => 'Pickhuben', 'address2' => '2-4', 'address3' => '', 'postal' => '11099', 'city' => 'Berlin', 'state' => 'Berlin', 'countryid' => 'DE', 'langid' => 'de', 'telephone' => '055544332221', 'email' => '[email protected]', 'telefax' => '055544333212', 'website' => 'unittest.aimeos.org', 'flag' => 0, 'pos' => '1' ),
18
-		array ( 'parentid' => 'customer/UTC003', 'company' => 'unitcompany', 'vatid' => 'DE999999999', 'salutation' => 'company', 'title' => 'unittitle', 'firstname' => 'unitfirstname', 'lastname' => 'unitlastname', 'address1' => 'unitaddress1', 'address2' => 'unitaddress2', 'address3' => 'unitaddress3', 'postal' => 'unitpostal', 'city' => 'unitcity', 'state' => 'unitstate', 'countryid' => 'DE', 'langid' => 'de', 'telephone' => '1234567890', 'email' => '[email protected]', 'telefax' => '1234567891', 'website' => 'unittest.aimeos.org', 'flag' => 0, 'pos' => '2' ),
19
-	),
9
+    'customer' => array(
10
+        'customer/UTC001' => array( 'code' => 'UTC001', 'label' => 'unitCustomer1', 'salutation' => 'mr', 'company' => 'ABC GmbH', 'vatid' => 'DE999999999', 'title' => 'Dr.', 'firstname' => 'Max', 'lastname' => 'Mustermann', 'address1' => 'Musterstraße', 'address2' => '1a', 'address3' => '', 'postal' => '20001', 'city' => 'Musterstadt', 'state' => 'Hamburg', 'langid' => 'de', 'countryid' => 'DE', 'telephone' => '01234567890', 'email' => '[email protected]', 'telefax' => '01234567890', 'website' => 'unittest.aimeos.org', 'birthday' => '1970-01-01', 'status' => '1', 'password' => 'test' ),
11
+        'customer/UTC002' => array( 'code' => 'UTC002', 'label' => 'unitCustomer2', 'salutation' => 'mrs', 'company' => 'ABC GmbH', 'vatid' => 'DE999999999', 'title' => 'Prof. Dr.', 'firstname' => 'Erika', 'lastname' => 'Mustermann', 'address1' => 'Heidestraße', 'address2' => '17', 'address3' => '', 'postal' => '45632', 'city' => 'Köln', 'state' => '', 'langid' => 'de', 'countryid' => 'DE', 'telephone' => '09876543210', 'email' => '[email protected]', 'telefax' => '09876543210', 'website' => 'unittest.aimeos.org', 'birthday' => '1970-01-01', 'status' => '0','password' =>  'test' ),
12
+        'customer/UTC003' => array( 'code' => 'UTC003', 'label' => 'unitCustomer3', 'salutation' => 'mr', 'company' => 'ABC GmbH', 'vatid' => 'DE999999999', 'title' => '', 'firstname' => 'Franz-Xaver', 'lastname' => 'Gabler', 'address1' => 'Phantasiestraße', 'address2' => '2', 'address3' => '', 'postal' => '23643', 'city' => 'Berlin', 'state' => 'Berlin', 'langid' => 'de', 'countryid' => 'DE', 'telephone' => '01234509876', 'email' => '[email protected]', 'telefax' => '055544333212', 'website' => 'unittest.aimeos.org', 'birthday' => '1970-01-01', 'status' => '1', 'password' => 'test' ),
13
+    ),
14
+    'customer/address' => array(
15
+        array ( 'parentid' => 'customer/UTC001', 'company' => 'ABC', 'vatid' => 'DE999999999', 'salutation' => 'mr', 'title' => 'Dr', 'firstname' => 'Our', 'lastname' => 'Unittest', 'address1' => 'Pickhuben', 'address2' => '2-4', 'address3' => '', 'postal' => '20457', 'city' => 'Hamburg', 'state' => 'Hamburg', 'countryid' => 'DE', 'langid' => 'de', 'telephone' => '055544332211', 'email' => '[email protected]', 'telefax' => '055544332212', 'website' => 'unittest.aimeos.org', 'flag' => 0, 'pos' => '0' ),
16
+        array ( 'parentid' => 'customer/UTC002', 'company' => 'ABC GmbH', 'vatid' => 'DE999999999', 'salutation' => 'mr', 'title' => 'Dr.', 'firstname' => 'Good', 'lastname' => 'Unittest', 'address1' => 'Pickhuben', 'address2' => '2-4', 'address3' => '', 'postal' => '20457', 'city' => 'Hamburg', 'state' => 'Hamburg', 'countryid' => 'DE', 'langid' => 'de', 'telephone' => '055544332211', 'email' => '[email protected]', 'telefax' => '055544332212', 'website' => 'unittest.aimeos.org', 'flag' => 0, 'pos' => '1' ),
17
+        array ( 'parentid' => 'customer/UTC002', 'company' => 'ABC GmbH', 'vatid' => 'DE999999999', 'salutation' => 'mr', 'title' => 'Dr.', 'firstname' => 'Good', 'lastname' => 'Unittest', 'address1' => 'Pickhuben', 'address2' => '2-4', 'address3' => '', 'postal' => '11099', 'city' => 'Berlin', 'state' => 'Berlin', 'countryid' => 'DE', 'langid' => 'de', 'telephone' => '055544332221', 'email' => '[email protected]', 'telefax' => '055544333212', 'website' => 'unittest.aimeos.org', 'flag' => 0, 'pos' => '1' ),
18
+        array ( 'parentid' => 'customer/UTC003', 'company' => 'unitcompany', 'vatid' => 'DE999999999', 'salutation' => 'company', 'title' => 'unittitle', 'firstname' => 'unitfirstname', 'lastname' => 'unitlastname', 'address1' => 'unitaddress1', 'address2' => 'unitaddress2', 'address3' => 'unitaddress3', 'postal' => 'unitpostal', 'city' => 'unitcity', 'state' => 'unitstate', 'countryid' => 'DE', 'langid' => 'de', 'telephone' => '1234567890', 'email' => '[email protected]', 'telefax' => '1234567891', 'website' => 'unittest.aimeos.org', 'flag' => 0, 'pos' => '2' ),
19
+    ),
20 20
 );
Please login to merge, or discard this patch.
lib/custom/setup/unittest/data/customer-list.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 return array (
9
-	'customer/lists/type' => array (
10
-		'text/default' => array( 'domain' => 'text', 'code' => 'default', 'label' => 'Standard', 'status' => 1 ),
11
-	),
9
+    'customer/lists/type' => array (
10
+        'text/default' => array( 'domain' => 'text', 'code' => 'default', 'label' => 'Standard', 'status' => 1 ),
11
+    ),
12 12
 
13
-	'customer/lists' => array (
14
-		array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => array(), 'pos' => 0, 'status' => 1 ),
15
-		array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/notify', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => array(), 'pos' => 1, 'status' => 1 ),
16
-		array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/newsletter', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => array(), 'pos' => 2, 'status' => 1 ),
17
-		array( 'parentid' => 'customer/UTC001', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => array(), 'pos' => 3, 'status' => 1 ),
18
-	),
13
+    'customer/lists' => array (
14
+        array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => array(), 'pos' => 0, 'status' => 1 ),
15
+        array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/notify', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => array(), 'pos' => 1, 'status' => 1 ),
16
+        array( 'parentid' => 'customer/UTC003', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/newsletter', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => array(), 'pos' => 2, 'status' => 1 ),
17
+        array( 'parentid' => 'customer/UTC001', 'typeid' => 'text/default', 'domain' => 'text', 'refid' => 'text/customer/information', 'start' => '2010-01-01 00:00:00', 'end' => '2100-01-01 00:00:00', 'config' => array(), 'pos' => 3, 'status' => 1 ),
18
+    ),
19 19
 );
Please login to merge, or discard this patch.
lib/custom/setup/unittest/CustomerAddEzpublishTestData.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -14,119 +14,119 @@
 block discarded – undo
14 14
  */
15 15
 class CustomerAddEzpublishTestData extends \Aimeos\MW\Setup\Task\CustomerAddTestData
16 16
 {
17
-	/**
18
-	 * Returns the list of task names which this task depends on.
19
-	 *
20
-	 * @return string[] List of task names
21
-	 */
22
-	public function getPreDependencies()
23
-	{
24
-		return array( 'TablesCreateEzpublish', 'EzuserAddAddress', 'MShopSetLocale', 'MediaAddTestData' );
25
-	}
26
-
27
-
28
-	/**
29
-	 * Adds attribute test data.
30
-	 */
31
-	public function migrate()
32
-	{
33
-		$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
34
-		if( !( $this->additional instanceof $iface ) ) {
35
-			throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
36
-		}
37
-
38
-		$context = $this->getEzContext( $this->additional );
39
-
40
-		$this->msg( 'Adding ezPublish customer test data', 0 );
41
-
42
-		$parentIds = array();
43
-		$ds = DIRECTORY_SEPARATOR;
44
-		$context->setEditor( 'ai-ezpublish:unittest' );
45
-		$path = __DIR__ . $ds . 'data' . $ds . 'customer.php';
46
-
47
-		if( ( $testdata = include( $path ) ) === false ){
48
-			throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) );
49
-		}
50
-
51
-
52
-		$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'Ezpublish' );
53
-		$customerAddressManager = $customerManager->getSubManager( 'address', 'Ezpublish' );
54
-
55
-		$search = $customerManager->createSearch();
56
-		$search->setConditions( $search->compare( '==', 'customer.code', array( 'UTC001', 'UTC002', 'UTC003' ) ) );
57
-		$items = $customerManager->searchItems( $search );
58
-
59
-		$this->conn->begin();
60
-
61
-		$customerManager->deleteItems( array_keys( $items ) );
62
-		$parentIds = $this->addCustomerData( $testdata, $customerManager, $customerAddressManager->createItem() );
63
-		$this->addCustomerAddressData( $testdata, $customerAddressManager, $parentIds );
64
-
65
-		$this->conn->commit();
66
-
67
-
68
-		$this->status( 'done' );
69
-	}
70
-
71
-
72
-	/**
73
-	 * Returns the Ezpublish context
74
-	 *
75
-	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
76
-	 * @return \Aimeos\MShop\Context\Item\Ezpublish Ezpublish context object
77
-	 */
78
-	protected function getEzContext( \Aimeos\MShop\Context\Item\Iface $context )
79
-	{
80
-		$class = '\Aimeos\MShop\Context\Item\Ezpublish';
81
-		if( is_a( $context, $class ) ) {
82
-			return $context;
83
-		}
84
-
85
-		$ezContext = new \Aimeos\MShop\Context\Item\Ezpublish();
86
-		$ezContext->setDatabaseManager( clone $context->getDatabaseManager() );
87
-		$ezContext->setSession( clone $context->getSession() );
88
-		$ezContext->setLogger( clone $context->getLogger() );
89
-		$ezContext->setLocale( clone $context->getLocale() );
90
-		$ezContext->setConfig( clone $context->getConfig() );
91
-		$ezContext->setCache( clone $context->getCache() );
92
-
93
-		$task = $this;
94
-
95
-		$ezContext->setEzUser( function( $code, $email, $password ) use ( $context ) {
96
-
97
-			$id = mt_rand( -0x7fffffff,-1 );
98
-			$dbm = $context->getDatabaseManager();
99
-			$dbconf = $context->getConfig()->get( 'resource/db-customer' );
100
-			$dbname = ( $dbconf ? 'db-customer' : 'db' );
101
-			$conn = $dbm->acquire( $dbname );
102
-
103
-			try
104
-			{
105
-				$stmt = $conn->create( 'INSERT INTO "ezuser" (
17
+    /**
18
+     * Returns the list of task names which this task depends on.
19
+     *
20
+     * @return string[] List of task names
21
+     */
22
+    public function getPreDependencies()
23
+    {
24
+        return array( 'TablesCreateEzpublish', 'EzuserAddAddress', 'MShopSetLocale', 'MediaAddTestData' );
25
+    }
26
+
27
+
28
+    /**
29
+     * Adds attribute test data.
30
+     */
31
+    public function migrate()
32
+    {
33
+        $iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
34
+        if( !( $this->additional instanceof $iface ) ) {
35
+            throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
36
+        }
37
+
38
+        $context = $this->getEzContext( $this->additional );
39
+
40
+        $this->msg( 'Adding ezPublish customer test data', 0 );
41
+
42
+        $parentIds = array();
43
+        $ds = DIRECTORY_SEPARATOR;
44
+        $context->setEditor( 'ai-ezpublish:unittest' );
45
+        $path = __DIR__ . $ds . 'data' . $ds . 'customer.php';
46
+
47
+        if( ( $testdata = include( $path ) ) === false ){
48
+            throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) );
49
+        }
50
+
51
+
52
+        $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context, 'Ezpublish' );
53
+        $customerAddressManager = $customerManager->getSubManager( 'address', 'Ezpublish' );
54
+
55
+        $search = $customerManager->createSearch();
56
+        $search->setConditions( $search->compare( '==', 'customer.code', array( 'UTC001', 'UTC002', 'UTC003' ) ) );
57
+        $items = $customerManager->searchItems( $search );
58
+
59
+        $this->conn->begin();
60
+
61
+        $customerManager->deleteItems( array_keys( $items ) );
62
+        $parentIds = $this->addCustomerData( $testdata, $customerManager, $customerAddressManager->createItem() );
63
+        $this->addCustomerAddressData( $testdata, $customerAddressManager, $parentIds );
64
+
65
+        $this->conn->commit();
66
+
67
+
68
+        $this->status( 'done' );
69
+    }
70
+
71
+
72
+    /**
73
+     * Returns the Ezpublish context
74
+     *
75
+     * @param \Aimeos\MShop\Context\Item\Iface $context Context object
76
+     * @return \Aimeos\MShop\Context\Item\Ezpublish Ezpublish context object
77
+     */
78
+    protected function getEzContext( \Aimeos\MShop\Context\Item\Iface $context )
79
+    {
80
+        $class = '\Aimeos\MShop\Context\Item\Ezpublish';
81
+        if( is_a( $context, $class ) ) {
82
+            return $context;
83
+        }
84
+
85
+        $ezContext = new \Aimeos\MShop\Context\Item\Ezpublish();
86
+        $ezContext->setDatabaseManager( clone $context->getDatabaseManager() );
87
+        $ezContext->setSession( clone $context->getSession() );
88
+        $ezContext->setLogger( clone $context->getLogger() );
89
+        $ezContext->setLocale( clone $context->getLocale() );
90
+        $ezContext->setConfig( clone $context->getConfig() );
91
+        $ezContext->setCache( clone $context->getCache() );
92
+
93
+        $task = $this;
94
+
95
+        $ezContext->setEzUser( function( $code, $email, $password ) use ( $context ) {
96
+
97
+            $id = mt_rand( -0x7fffffff,-1 );
98
+            $dbm = $context->getDatabaseManager();
99
+            $dbconf = $context->getConfig()->get( 'resource/db-customer' );
100
+            $dbname = ( $dbconf ? 'db-customer' : 'db' );
101
+            $conn = $dbm->acquire( $dbname );
102
+
103
+            try
104
+            {
105
+                $stmt = $conn->create( 'INSERT INTO "ezuser" (
106 106
 					"contentobject_id", "email", "login", "login_normalized", "password_hash", "password_hash_type"
107 107
 				) VALUES (
108 108
 					?, ?, ?, ?, ?, 5
109 109
 				)' );
110 110
 
111
-				$stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
112
-				$stmt->bind( 2, $email );
113
-				$stmt->bind( 3, $code );
114
-				$stmt->bind( 4, $code );
115
-				$stmt->bind( 5, $password );
111
+                $stmt->bind( 1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
112
+                $stmt->bind( 2, $email );
113
+                $stmt->bind( 3, $code );
114
+                $stmt->bind( 4, $code );
115
+                $stmt->bind( 5, $password );
116 116
 
117
-				$stmt->execute()->finish();
117
+                $stmt->execute()->finish();
118 118
 
119
-				$dbm->release( $conn, $dbname );
120
-			}
121
-			catch( \Exception $e )
122
-			{
123
-				$dbm->release( $conn, $dbname );
124
-				throw $e;
125
-			}
119
+                $dbm->release( $conn, $dbname );
120
+            }
121
+            catch( \Exception $e )
122
+            {
123
+                $dbm->release( $conn, $dbname );
124
+                throw $e;
125
+            }
126 126
 
127
-			return $id;
128
-		} );
127
+            return $id;
128
+        } );
129 129
 
130
-		return $ezContext;
131
-	}
130
+        return $ezContext;
131
+    }
132 132
 }
Please login to merge, or discard this patch.