Skip to content

Commit da3ddb5

Browse files
committed
(wip) fix test
1 parent 77b85bd commit da3ddb5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

tests/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ To run a single test :
3838

3939
## Memento
4040

41+
### Output to Console during Tests
42+
4143
To output to console from a codeception test use :
4244
```
4345
\Codeception\Util\Debug::debug($someVariable);
@@ -47,3 +49,10 @@ With debug mode enabled :
4749
```
4850
../vendor/bin/codecept run --debug codeception/unit/workflow/helpers/WorkflowHelperTest.php
4951
```
52+
53+
### Enable XDebug With Codeception
54+
55+
Check XDebug is installed :
56+
- run `php -i > info.txt`
57+
- copy/paste `info.txt` into [this form](https://xdebug.org/wizard.php) and check the result
58+
- if needed, follow *Installation instructions*.

tests/codeception/unit/workflow/events/ChangeStatusExtendedEventTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function setup()
3232
'namespace' => 'tests\codeception\unit\models'
3333
]
3434
]);
35-
35+
3636
Yii::$app->set('eventSequence',[
3737
'class'=> 'raoul2000\workflow\events\ExtendedEventSequence',
3838
]);
@@ -54,6 +54,7 @@ public function testChangeStatusEventOnSaveSuccess()
5454
$this->model->on(
5555
WorkflowEvent::beforeEnterStatus(),
5656
function($event) {
57+
codecept_debug("beforeEnterStatus");
5758
$this->eventsBefore[] = $event;
5859
}
5960
);
@@ -63,10 +64,12 @@ function($event) {
6364
$this->eventsAfter[] = $event;
6465
}
6566
);
67+
codecept_debug(count($this->eventsBefore));
6668
verify('event handler handlers have been called', count($this->eventsBefore) == 0 && count($this->eventsAfter) == 0)->true();
6769

6870
$this->model->enterWorkflow();
6971
verify('current status is set',$this->model->hasWorkflowStatus())->true();
72+
codecept_debug(count($this->eventsBefore));
7073
expect('event handler handlers have been called', count($this->eventsBefore) == 1 && count($this->eventsAfter) == 1)->true();
7174

7275
$this->model->status = 'Item04Workflow/B';

0 commit comments

Comments
 (0)