|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @link https://github.com/old-town/old-town-workflow |
|
4
|
|
|
* @author Malofeykin Andrey <[email protected]> |
|
5
|
|
|
*/ |
|
6
|
|
|
namespace OldTown\Workflow\PhpUnitTest\Loader; |
|
7
|
|
|
|
|
8
|
|
|
use OldTown\Workflow\Loader\AbstractWorkflowFactory; |
|
9
|
|
|
use PHPUnit_Framework_TestCase as TestCase; |
|
10
|
|
|
use OldTown\Workflow\Util\Properties\Properties; |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class AbstractWorkflowFactoryTest |
|
15
|
|
|
* |
|
16
|
|
|
* @package OldTown\Workflow\PhpUnitTest\Loader |
|
17
|
|
|
*/ |
|
18
|
|
|
class AbstractWorkflowFactoryTest extends TestCase |
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* @var AbstractWorkflowFactory |
|
22
|
|
|
*/ |
|
23
|
|
|
private $abstractWorkflowFactory; |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* |
|
28
|
|
|
*/ |
|
29
|
|
|
public function setUp() |
|
30
|
|
|
{ |
|
31
|
|
|
$this->abstractWorkflowFactory = $this->getMockForAbstractClass(AbstractWorkflowFactory::class); |
|
|
|
|
|
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Установка Properties через конструктор |
|
37
|
|
|
* |
|
38
|
|
|
* @return void |
|
39
|
|
|
*/ |
|
40
|
|
|
public function testSetPropertiesInConstructor() |
|
41
|
|
|
{ |
|
42
|
|
|
$expectedProperties = new Properties(); |
|
43
|
|
|
/** @var AbstractWorkflowFactory $abstractWorkflowFactory */ |
|
44
|
|
|
$abstractWorkflowFactory = $this->getMockForAbstractClass(AbstractWorkflowFactory::class, ['p' => $expectedProperties]); |
|
45
|
|
|
|
|
46
|
|
|
$actualProperties = $abstractWorkflowFactory->getProperties(); |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
static::assertTrue($expectedProperties === $actualProperties); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Проверка работы метода init |
|
55
|
|
|
* |
|
56
|
|
|
* @return void |
|
57
|
|
|
*/ |
|
58
|
|
|
public function testInit() |
|
59
|
|
|
{ |
|
60
|
|
|
$expectedProperties = new Properties(); |
|
61
|
|
|
$this->abstractWorkflowFactory->init($expectedProperties); |
|
62
|
|
|
|
|
63
|
|
|
$actualProperties = $this->abstractWorkflowFactory->getProperties(); |
|
64
|
|
|
|
|
65
|
|
|
static::assertTrue($expectedProperties === $actualProperties); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Проверка работы метода initDone |
|
71
|
|
|
* |
|
72
|
|
|
* @return void |
|
73
|
|
|
*/ |
|
74
|
|
|
public function testInitDone() |
|
75
|
|
|
{ |
|
76
|
|
|
static::assertNull($this->abstractWorkflowFactory->initDone()); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..