ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilStopWorkflowActivityTest Class Reference

ilStopWorkflowActivityTest is part of the workflow engine. More...

+ Inheritance diagram for ilStopWorkflowActivityTest:
+ Collaboration diagram for ilStopWorkflowActivityTest:

Public Member Functions

 setUp ()
 
 tearDown ()
 
 testConstructorValidContext ()
 
 testGetContext ()
 
 testExecute ()
 

Data Fields

 $test_dir
 vfsStream Test Directory, see setup. More...
 

Detailed Description

ilStopWorkflowActivityTest is part of the workflow engine.

This class holds all tests for the class activities/class.ilStopWorkflowActivity

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

/

Definition at line 16 of file ilStopWorkflowActivityTest.php.

Member Function Documentation

◆ setUp()

ilStopWorkflowActivityTest::setUp ( )

Definition at line 21 of file ilStopWorkflowActivityTest.php.

References defined.

22  {
23  chdir(dirname(__FILE__));
24  chdir('../../../../');
25 
26  try {
27  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
28  //ilUnitUtil::performInitialisation();
29  } catch (Exception $exception) {
30  if (!defined('IL_PHPUNIT_TEST')) {
31  define('IL_PHPUNIT_TEST', false);
32  }
33  }
34 
35  // Empty workflow.
36  require_once './Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
37  $this->workflow = new ilEmptyWorkflow();
38 
39  // Basic node
40  require_once './Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
41  $this->node = new ilBasicNode($this->workflow);
42 
43  // Wiring up so the node is attached to the workflow.
44  $this->workflow->addNode($this->node);
45 
46  require_once './Services/WorkflowEngine/classes/activities/class.ilStopWorkflowActivity.php';
47 
48  $this->test_dir = vfs\vfsStream::setup('example');
49  }
PhpIncludeInspection
PhpIncludeInspection
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ tearDown()

ilStopWorkflowActivityTest::tearDown ( )

Definition at line 51 of file ilStopWorkflowActivityTest.php.

References $ilSetting.

52  {
53  global $ilSetting;
54  if ($ilSetting != null) {
55  //$ilSetting->delete('IL_PHPUNIT_TEST_TIME');
56  //$ilSetting->delete('IL_PHPUNIT_TEST_MICROTIME');
57  }
58  }
global $ilSetting
Definition: privfeed.php:17

◆ testConstructorValidContext()

ilStopWorkflowActivityTest::testConstructorValidContext ( )

Definition at line 60 of file ilStopWorkflowActivityTest.php.

61  {
62  // Act
63  $activity = new ilStopWorkflowActivity($this->node);
64 
65  // Assert
66  // No exception - good
67  $this->assertTrue(
68  true,
69  'Construction failed with valid context passed to constructor.'
70  );
71  }

◆ testExecute()

ilStopWorkflowActivityTest::testExecute ( )

Definition at line 89 of file ilStopWorkflowActivityTest.php.

References array.

90  {
91  $workflowMock = $this->getMockBuilder('ilEmptyWorkflow')
92  ->setMethods(array('stopWorkflow'))
93  ->getMock();
94 
95  $workflowMock->expects($this->once())
96  ->method('stopWorkflow');
97  $node = new ilBasicNode($workflowMock);
98 
99  $activity = new ilStopWorkflowActivity($node);
100 
101  // Act
102  $activity->execute();
103  }
PhpIncludeInspection
Create styles array
The data for the language used.

◆ testGetContext()

ilStopWorkflowActivityTest::testGetContext ( )

Definition at line 73 of file ilStopWorkflowActivityTest.php.

74  {
75  // Arrange
76  $activity = new ilStopWorkflowActivity($this->node);
77 
78  // Act
79  $actual = $activity->getContext();
80 
81  // Assert
82  if ($actual === $this->node) {
83  $this->assertEquals($actual, $this->node);
84  } else {
85  $this->assertTrue(false, 'Context not identical.');
86  }
87  }

Field Documentation

◆ $test_dir

ilStopWorkflowActivityTest::$test_dir

vfsStream Test Directory, see setup.

Definition at line 19 of file ilStopWorkflowActivityTest.php.


The documentation for this class was generated from the following file: