@@ 91-104 (lines=14) @@ | ||
88 | /** |
|
89 | * Ensure WorkflowInstance returns expected values for a Published target object. |
|
90 | */ |
|
91 | public function testInstanceGetTargetPublished() |
|
92 | { |
|
93 | $def = $this->createDefinition(); |
|
94 | $target = $this->objFromFixture(SiteTree::class, 'published-object'); |
|
95 | $target->publishRecursive(); |
|
96 | ||
97 | $instance = $this->objFromFixture(WorkflowInstance::class, 'target-is-published'); |
|
98 | $instance->beginWorkflow($def); |
|
99 | $instance->execute(); |
|
100 | ||
101 | $this->assertTrue($target->isPublished()); |
|
102 | $this->assertEquals($target->ID, $instance->getTarget()->ID); |
|
103 | $this->assertEquals($target->Title, $instance->getTarget()->Title); |
|
104 | } |
|
105 | ||
106 | /** |
|
107 | * Ensure WorkflowInstance returns expected values for a Draft target object. |
|
@@ 109-121 (lines=13) @@ | ||
106 | /** |
|
107 | * Ensure WorkflowInstance returns expected values for a Draft target object. |
|
108 | */ |
|
109 | public function testInstanceGetTargetDraft() |
|
110 | { |
|
111 | $def = $this->createDefinition(); |
|
112 | $target = $this->objFromFixture(SiteTree::class, 'draft-object'); |
|
113 | ||
114 | $instance = $this->objFromFixture(WorkflowInstance::class, 'target-is-draft'); |
|
115 | $instance->beginWorkflow($def); |
|
116 | $instance->execute(); |
|
117 | ||
118 | $this->assertFalse($target->isPublished()); |
|
119 | $this->assertEquals($target->ID, $instance->getTarget()->ID); |
|
120 | $this->assertEquals($target->Title, $instance->getTarget()->Title); |
|
121 | } |
|
122 | ||
123 | public function testPublishAction() |
|
124 | { |