1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2014-2021 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
namespace Aimeos\Upscheme\Task; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Adds FOS user customer test data. |
14
|
|
|
*/ |
15
|
|
|
class CustomerAddTypo3TestData extends CustomerAddTestData |
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 after() : array |
23
|
|
|
{ |
24
|
|
|
return ['TablesAddTypo3TestData', 'ProductAddTestData']; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Returns the list of task names which depends on this task. |
30
|
|
|
* |
31
|
|
|
* @return string[] List of task names |
32
|
|
|
*/ |
33
|
|
|
public function before() : array |
34
|
|
|
{ |
35
|
|
|
return ['CustomerAddTestData']; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Adds customer test data |
41
|
|
|
*/ |
42
|
|
|
public function up() |
43
|
|
|
{ |
44
|
|
|
$this->info( 'Adding TYPO3 customer test data', 'v' ); |
45
|
|
|
|
46
|
|
|
$this->db( 'db-customer' )->exec( 'DELETE FROM fe_users WHERE email LIKE \'test%@example.com\'' ); |
47
|
|
|
|
48
|
|
|
$manager = $this->getManager( 'customer' )->getSubManager( 'group' ); |
49
|
|
|
$search = $manager->filter(); |
50
|
|
|
$search->setConditions( $search->compare( '==', 'customer.group.code', 'unitgroup' ) ); |
51
|
|
|
$manager->delete( $manager->search( $search )->toArray() ); |
52
|
|
|
|
53
|
|
|
$this->context()->setEditor( 'ai-typo3:lib/custom' ); |
|
|
|
|
54
|
|
|
$this->process( __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'customer.php' ); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Returns the manager for the current setup task |
60
|
|
|
* |
61
|
|
|
* @param string $domain Domain name of the manager |
62
|
|
|
* @return \Aimeos\MShop\Common\Manager\Iface Manager object |
63
|
|
|
*/ |
64
|
|
|
protected function getManager( $domain ) |
65
|
|
|
{ |
66
|
|
|
if( $domain === 'customer' ) { |
67
|
|
|
return \Aimeos\MShop\Customer\Manager\Factory::create( $this->context(), 'Typo3' ); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
return parent::getManager( $domain ); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|