ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
28  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
29  //ilUnitUtil::performInitialisation();
30  }
31  catch ( Exception $exception )
32  {
33  if (!defined('IL_PHPUNIT_TEST'))
34  {
35  define('IL_PHPUNIT_TEST', FALSE);
36  }
37  }
38 
39  // Empty workflow.
40  require_once './Services/WorkflowEngine/classes/workflows/class.ilEmptyWorkflow.php';
41  $this->workflow = new ilEmptyWorkflow();
42 
43  // Basic node
44  require_once './Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php';
45  $this->node = new ilBasicNode($this->workflow);
46 
47  // Wiring up so the node is attached to the workflow.
48  $this->workflow->addNode($this->node);
49 
50  require_once './Services/WorkflowEngine/classes/activities/class.ilStopWorkflowActivity.php';
51 
52  $this->test_dir = vfs\vfsStream::setup('example');
53  }
PhpIncludeInspection
PhpIncludeInspection
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ tearDown()

ilStopWorkflowActivityTest::tearDown ( )

Definition at line 55 of file ilStopWorkflowActivityTest.php.

References $ilSetting.

56  {
57  global $ilSetting;
58  if ($ilSetting != NULL)
59  {
60  //$ilSetting->delete('IL_PHPUNIT_TEST_TIME');
61  //$ilSetting->delete('IL_PHPUNIT_TEST_MICROTIME');
62  }
63  }
global $ilSetting
Definition: privfeed.php:17

◆ testConstructorValidContext()

ilStopWorkflowActivityTest::testConstructorValidContext ( )

Definition at line 65 of file ilStopWorkflowActivityTest.php.

66  {
67  // Act
68  $activity = new ilStopWorkflowActivity($this->node);
69 
70  // Assert
71  // No exception - good
72  $this->assertTrue(
73  true,
74  'Construction failed with valid context passed to constructor.'
75  );
76  }

◆ testExecute()

ilStopWorkflowActivityTest::testExecute ( )

Definition at line 95 of file ilStopWorkflowActivityTest.php.

References array.

96  {
97  $workflowMock = $this->getMockBuilder('ilEmptyWorkflow')
98  ->setMethods(array('stopWorkflow'))
99  ->getMock();
100 
101  $workflowMock->expects($this->once())
102  ->method('stopWorkflow');
103  $node = new ilBasicNode($workflowMock);
104 
105  $activity = new ilStopWorkflowActivity($node);
106 
107  // Act
108  $activity->execute();
109  }
PhpIncludeInspection
Create styles array
The data for the language used.

◆ testGetContext()

ilStopWorkflowActivityTest::testGetContext ( )

Definition at line 78 of file ilStopWorkflowActivityTest.php.

79  {
80  // Arrange
81  $activity = new ilStopWorkflowActivity($this->node);
82 
83  // Act
84  $actual = $activity->getContext();
85 
86  // Assert
87  if ($actual === $this->node)
88  {
89  $this->assertEquals($actual, $this->node);
90  } else {
91  $this->assertTrue(false, 'Context not identical.');
92  }
93  }

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: