Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class OrderAddCartTestData extends Base |
||
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 |
||
25 | } |
||
26 | |||
27 | |||
28 | /** |
||
29 | * Adds order test data. |
||
30 | */ |
||
31 | public function up() |
||
32 | { |
||
33 | $this->info( 'Adding order cart test data', 'vv' ); |
||
34 | |||
35 | $context = $this->context()->setEditor( 'core' ); |
||
|
|||
36 | |||
37 | $ds = DIRECTORY_SEPARATOR; |
||
38 | $path = __DIR__ . $ds . 'data' . $ds . 'order-cart.php'; |
||
39 | |||
40 | if( ( $testdata = include( $path ) ) == false ) { |
||
41 | throw new \RuntimeException( sprintf( 'No file "%1$s" found for order carts', $path ) ); |
||
42 | } |
||
43 | |||
44 | $manager = \Aimeos\MShop::create( $context, 'order/cart', 'Standard' ); |
||
45 | |||
46 | foreach( $testdata as $entry ) { |
||
47 | $manager->save( $manager->create()->fromArray( $entry, true ) )->setCustomerId( $this->getCustomer()->getId() ); |
||
48 | } |
||
49 | } |
||
50 | |||
51 | |||
52 | protected function getCustomer() : \Aimeos\MShop\Customer\Item\Iface |
||
56 | } |
||
57 | } |
||
58 |