Completed
Push — master ( 58b639...6e0030 )
by Aimeos
11:05
created

CustomerPropertyAddLaravelTestData::migrate()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 21
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.3142
c 0
b 0
f 0
cc 3
eloc 12
nc 3
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2018
6
 */
7
8
9
namespace Aimeos\MW\Setup\Task;
10
11
12
/**
13
 * Adds customer property test data.
14
 */
15
class CustomerPropertyAddLaravelTestData
16
	extends \Aimeos\MW\Setup\Task\CustomerAddPropertyTestData
0 ignored issues
show
Coding Style introduced by
The extends keyword must be on the same line as the class name
Loading history...
17
{
18
19
	/**
20
	 * Returns the list of task names which this task depends on.
21
	 *
22
	 * @return string[] List of task names
23
	 */
24
	public function getPreDependencies()
25
	{
26
		return array( 'TablesCreateLaravel', 'CustomerAddLaravelTestData', 'LocaleAddTestData' );
27
	}
28
29
30
	/**
31
	 * Adds customer test data.
32
	 */
33
	public function migrate()
34
	{
35
		$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
36
		if( !( $this->additional instanceof $iface ) ) {
37
			throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
38
		}
39
40
		$this->msg( 'Adding customer-property Laravel test data', 0 );
41
		$this->additional->setEditor( 'ai-laravel:unittest' );
42
43
		$ds = DIRECTORY_SEPARATOR;
44
		$path = __DIR__ . $ds . 'data' . $ds . 'customer-property.php';
45
46
		if( ( $testdata = include( $path ) ) == false ) {
47
			throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for customer domain', $path ) );
48
		}
49
50
		$this->addCustomerPropertyData( $testdata, 'Laravel' );
51
52
		$this->status( 'done' );
53
	}
54
}