86 : void
87 {
88 $sql =
89 "SELECT ref_id, condition_operator, value" . PHP_EOL
90 . "FROM post_conditions" . PHP_EOL
91 . "WHERE ref_id IN (33,44)" . PHP_EOL
92 ;
93
94 $rows = [
95 [
96 'ref_id' => 33,
97 'condition_operator' => 'failed',
98 'value' => "11"
99 ],
100 [
101 'ref_id' => 44,
102 'condition_operator' => 'finished',
103 'value' => "12"
104 ],
105 null
106 ];
107
108 $return_statement = $this->getMockBuilder(ilDBStatement::class)->getMock();
109 $this->db
110 ->expects($this->once())
111 ->method('query')
112 ->with($sql)
113 ->willReturn($return_statement)
114 ;
115 $this->db
116 ->expects($this->any())
117 ->method('fetchAssoc')
118 ->with($return_statement)
119 ->willReturnOnConsecutiveCalls(...$rows)
120 ;
121
123 $result = $obj->select([33,44]);
124
125 $this->assertEquals(33, $result[0]->getRefId());
126 $this->assertEquals('failed', $result[0]->getConditionOperator());
127 $this->assertEquals(
"11", $result[0]->
getValue());
128
129 $this->assertEquals(44, $result[1]->getRefId());
130 $this->assertEquals('finished', $result[1]->getConditionOperator());
131 $this->assertEquals(
"12", $result[1]->
getValue());
132 }