Passed
Push — master ( bb78f2...5dc509 )
by Aimeos
19:06 queued 11:52
created

CustomerAddTypo3TestData   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 14
dl 0
loc 56
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A after() 0 3 1
A up() 0 13 1
A getManager() 0 7 2
A before() 0 3 1
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' );
0 ignored issues
show
Bug introduced by
The method context() does not exist on Aimeos\Upscheme\Task\CustomerAddTypo3TestData. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

53
		$this->/** @scrutinizer ignore-call */ 
54
         context()->setEditor( 'ai-typo3:lib/custom' );
Loading history...
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