19 declare(strict_types=1);
30 protected function setUp(): void
32 $this->db = $this->createMock(ilDBInterface::class);
39 $this->assertInstanceOf(ilLSPostConditionDB::class, $obj);
46 $result = $obj->select([]);
48 $this->assertIsArray($result);
49 $this->assertEmpty($result);
55 "SELECT ref_id, condition_operator, value" . PHP_EOL
56 .
"FROM post_conditions" . PHP_EOL
57 .
"WHERE ref_id IN (20,22)" . PHP_EOL
60 $return = $this->getMockBuilder(ilDBStatement::class)->getMock();
62 ->expects($this->once())
68 ->expects($this->once())
69 ->method(
'fetchAssoc')
75 $result = $obj->select([20,22]);
77 $this->assertEquals(20, $result[0]->getRefId());
79 $this->assertNull($result[0]->
getValue());
81 $this->assertEquals(22, $result[1]->getRefId());
83 $this->assertNull($result[1]->
getValue());
89 "SELECT ref_id, condition_operator, value" . PHP_EOL
90 .
"FROM post_conditions" . PHP_EOL
91 .
"WHERE ref_id IN (33,44)" . PHP_EOL
97 'condition_operator' =>
'failed',
102 'condition_operator' =>
'finished',
108 $return_statement = $this->getMockBuilder(ilDBStatement::class)->getMock();
110 ->expects($this->once())
113 ->willReturn($return_statement)
116 ->expects($this->any())
117 ->method(
'fetchAssoc')
118 ->with($return_statement)
119 ->willReturnOnConsecutiveCalls(...$rows)
123 $result = $obj->select([33,44]);
125 $this->assertEquals(33, $result[0]->getRefId());
126 $this->assertEquals(
'failed', $result[0]->getConditionOperator());
127 $this->assertEquals(
"11", $result[0]->
getValue());
129 $this->assertEquals(44, $result[1]->getRefId());
130 $this->assertEquals(
'finished', $result[1]->getConditionOperator());
131 $this->assertEquals(
"12", $result[1]->
getValue());
137 "DELETE FROM post_conditions" . PHP_EOL
138 .
"WHERE ref_id IN (20,22)" . PHP_EOL
142 ->expects($this->once())
143 ->method(
'manipulate')
148 $obj->delete([20,22]);
Storage for ilLSPostConditions.
const STD_ALWAYS_OPERATOR
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
testSelectWithNoDBResults()
testSelectWithDBResults()
testSelectWithEmptyArray()