Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public function up() |
||
32 | { |
||
33 | $this->info( 'Adding basket test data', 'vv' ); |
||
34 | $context = $this->context()->setEditor( 'core' ); |
||
|
|||
35 | |||
36 | $path = __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'basket.php'; |
||
37 | |||
38 | if( ( $testdata = include( $path ) ) == false ) { |
||
39 | throw new \RuntimeException( sprintf( 'No file "%1$s" found for baskets', $path ) ); |
||
40 | } |
||
41 | |||
42 | $orderManager = \Aimeos\MShop::create( $context, 'order', 'Standard' ); |
||
43 | $manager = \Aimeos\MShop::create( $context, 'basket', 'Standard' ); |
||
44 | $manager->begin(); |
||
45 | |||
46 | foreach( $testdata as $entry ) { |
||
47 | $manager->save( $manager->create()->fromArray( $entry, true )->setItem( $orderManager->create() ) ); |
||
48 | } |
||
49 | |||
50 | $manager->commit(); |
||
51 | } |
||
60 |