1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2014 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
namespace Aimeos\MW\Setup\Task; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Adds customer list test data. |
14
|
|
|
*/ |
15
|
|
|
class CustomerListAddFosUserTestData |
16
|
|
|
extends \Aimeos\MW\Setup\Task\CustomerListAddTestData |
|
|
|
|
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( 'TablesCreateFosUser', 'CustomerAddFosUserTestData', '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 Fos user bundle test data', 0 ); |
40
|
|
|
$this->additional->setEditor( 'ai-symfony: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, 'FosUser' ); |
57
|
|
|
|
58
|
|
|
$this->status( 'done' ); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|