◆ getMockEnviroment()
ilOrgUnitOperationContextRegisteredObjectiveTest::getMockEnviroment |
( |
bool |
$expect_insert, |
|
|
int |
$expected_parent_id = 0 |
|
) |
| |
|
protected |
Definition at line 29 of file ilOrgUnitOperationContextRegisteredObjectiveTest.php.
Referenced by testAchieve(), testIsApplicable(), and testIsApplicableInvalidParentException().
33 $db = $this->createMock(ilDBInterface::class);
36 ->expects(self::once())
38 ->with(
'il_orgu_op_contexts', [
39 'id' => [
'integer', $this->next_id],
40 'context' => [
'text', $this->context],
41 'parent_context_id' => [
'integer', $expected_parent_id]
44 ->expects(self::once())
46 ->with(
'il_orgu_op_contexts')
47 ->willReturn($this->next_id);
50 $env = $this->createMock(Environment::class);
52 ->method(
'getResource')
53 ->with(Environment::RESOURCE_DATABASE)
An environment holds resources to be used in the setup process.
◆ getMockObjective()
ilOrgUnitOperationContextRegisteredObjectiveTest::getMockObjective |
( |
int |
$existing_context_id, |
|
|
int |
$parent_id, |
|
|
string |
$context_name, |
|
|
?string |
$parent_context = null |
|
) |
| |
|
protected |
Definition at line 59 of file ilOrgUnitOperationContextRegisteredObjectiveTest.php.
Referenced by testAchieve(), testGetHash(), testGetPreconditions(), testIsApplicable(), and testIsApplicableInvalidParentException().
67 ilOrgUnitOperationContextRegisteredObjective::class
69 ->setConstructorArgs([$context_name, $parent_context])
70 ->onlyMethods([
'getContextId'])
74 [$context_name, $existing_context_id],
75 [$parent_context, $parent_id]
79 ->method(
'getContextId')
81 function ($db,
$context) use (&$consecutive) {
82 list($econtext, $ret) = array_shift($consecutive);
83 $this->assertInstanceOf(ilDBInterface::class, $db);
84 $this->assertEquals($econtext,
$context);
◆ testAchieve()
ilOrgUnitOperationContextRegisteredObjectiveTest::testAchieve |
( |
| ) |
|
◆ testGetHash()
ilOrgUnitOperationContextRegisteredObjectiveTest::testGetHash |
( |
| ) |
|
|
protected |
◆ testGetPreconditions()
ilOrgUnitOperationContextRegisteredObjectiveTest::testGetPreconditions |
( |
| ) |
|
|
protected |
Definition at line 102 of file ilOrgUnitOperationContextRegisteredObjectiveTest.php.
References getMockObjective().
104 $env = $this->createMock(Environment::class);
106 $this->assertContainsOnlyInstancesOf(
107 ilDatabaseInitializedObjective::class,
108 $obj->getPreconditions($env)
getMockObjective(int $existing_context_id, int $parent_id, string $context_name, ?string $parent_context=null)
◆ testIsApplicable()
ilOrgUnitOperationContextRegisteredObjectiveTest::testIsApplicable |
( |
| ) |
|
Definition at line 112 of file ilOrgUnitOperationContextRegisteredObjectiveTest.php.
References getMockEnviroment(), and getMockObjective().
121 $this->assertTrue($obj->isApplicable($env));
128 $this->assertNotTrue($obj->isApplicable($env));
136 $this->assertTrue($obj->isApplicable($env));
144 $this->assertNotTrue($obj->isApplicable($env));
getMockEnviroment(bool $expect_insert, int $expected_parent_id=0)
getMockObjective(int $existing_context_id, int $parent_id, string $context_name, ?string $parent_context=null)
◆ testIsApplicableInvalidParentException()
ilOrgUnitOperationContextRegisteredObjectiveTest::testIsApplicableInvalidParentException |
( |
| ) |
|
◆ $context
string ilOrgUnitOperationContextRegisteredObjectiveTest::$context = 'first context' |
|
protected |
◆ $next_id
int ilOrgUnitOperationContextRegisteredObjectiveTest::$next_id = 3 |
|
protected |
The documentation for this class was generated from the following file: