1 | <?php |
||||||
2 | |||||||
3 | /** |
||||||
4 | * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
||||||
5 | * @copyright Metaways Infosystems GmbH, 2012 |
||||||
6 | * @copyright Aimeos (aimeos.org), 2015-2018 |
||||||
7 | */ |
||||||
8 | |||||||
9 | |||||||
10 | namespace Aimeos\MW\Setup\Task; |
||||||
11 | |||||||
12 | |||||||
13 | /** |
||||||
14 | * Adds admin job test data. |
||||||
15 | */ |
||||||
16 | class JobAddTestData extends \Aimeos\MW\Setup\Task\Base |
||||||
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 ['MShopSetLocale']; |
||||||
27 | } |
||||||
28 | |||||||
29 | |||||||
30 | /** |
||||||
31 | * Adds admin job test data. |
||||||
32 | */ |
||||||
33 | public function migrate() |
||||||
34 | { |
||||||
35 | \Aimeos\MW\Common\Base::checkClass( \Aimeos\MShop\Context\Item\Iface::class, $this->additional ); |
||||||
36 | |||||||
37 | $this->msg( 'Adding admin test data', 0 ); |
||||||
38 | $this->additional->setEditor( 'core:lib/mshoplib' ); |
||||||
39 | |||||||
40 | $this->addJobTestData(); |
||||||
41 | |||||||
42 | $this->status( 'done' ); |
||||||
43 | } |
||||||
44 | |||||||
45 | |||||||
46 | /** |
||||||
47 | * Adds the job test data. |
||||||
48 | * |
||||||
49 | * @throws \Aimeos\MW\Setup\Exception If a required ID is not available |
||||||
50 | */ |
||||||
51 | private function addJobTestData() |
||||||
52 | { |
||||||
53 | $adminJobManager = \Aimeos\MAdmin\Job\Manager\Factory::create( $this->additional, 'Standard' ); |
||||||
54 | |||||||
55 | $ds = DIRECTORY_SEPARATOR; |
||||||
56 | $path = __DIR__ . $ds . 'data' . $ds . 'job.php'; |
||||||
57 | |||||||
58 | if( ( $testdata = include( $path ) ) == false ) { |
||||||
59 | throw new \Aimeos\MShop\Exception( sprintf( 'No file "%1$s" found for job domain', $path ) ); |
||||||
60 | } |
||||||
61 | |||||||
62 | $job = $adminJobManager->createItem(); |
||||||
63 | |||||||
64 | $adminJobManager->begin(); |
||||||
65 | |||||||
66 | foreach( $testdata['job'] as $dataset ) |
||||||
67 | { |
||||||
68 | $job->setId( null ); |
||||||
69 | $job->setLabel( $dataset['label'] ); |
||||||
70 | $job->setMethod( $dataset['method'] ); |
||||||
0 ignored issues
–
show
|
|||||||
71 | $job->setParameter( $dataset['parameter'] ); |
||||||
0 ignored issues
–
show
The method
setParameter() does not exist on Aimeos\MShop\Attribute\Item\Iface .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
72 | $job->setResult( $dataset['result'] ); |
||||||
0 ignored issues
–
show
The method
setResult() does not exist on Aimeos\MShop\Attribute\Item\Iface .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
73 | $job->setStatus( $dataset['status'] ); |
||||||
74 | |||||||
75 | $adminJobManager->saveItem( $job, false ); |
||||||
76 | } |
||||||
77 | |||||||
78 | $adminJobManager->commit(); |
||||||
79 | } |
||||||
80 | } |
||||||
81 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.