ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
BasicTaskFactoryTest.php
Go to the documentation of this file.
1<?php
2
27
34use PHPUnit\Framework\TestCase;
35
36class BasicTaskFactoryTest extends TestCase
37{
38 public function testBasicFactory(): void
39 {
40 $dic = new Container();
41 $injector = new Injector($dic, new BaseDependencyMap());
42 $taskFactory = new BasicTaskFactory($injector);
43 $plusJob = $taskFactory->createTask(PlusJob::class, [1, 2]);
44 $this->assertInstanceOf(\ILIAS\BackgroundTasks\Implementation\Tasks\PlusJob::class, $plusJob);
45 $plusJobInput = $plusJob->getInput();
46 $one = new IntegerValue();
47 $one->setValue(1);
48 $this->assertTrue($plusJobInput[0]->equals($one));
49
50 $a = new IntegerValue();
51 $a->setValue(1);
52 $b = new IntegerValue();
53 $b->setValue(2);
54 $plusJob = $taskFactory->createTask(PlusJob::class, [$a, $b]);
55 $this->assertInstanceOf(\ILIAS\BackgroundTasks\Implementation\Tasks\PlusJob::class, $plusJob);
56 $plusJobInput = $plusJob->getInput();
57 $this->assertTrue($plusJobInput[0]->equals($one));
58 }
59}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
$dic
Definition: ltiresult.php:33
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples