193 : void
194 {
195 $sql =
196 'SELECT abstract, extro, abstract_image, extro_image, gallery' . PHP_EOL
197 . 'FROM lso_settings' . PHP_EOL
198 . 'WHERE obj_id = 333' . PHP_EOL
199 ;
200
201 $values = [
202 'obj_id' => ['integer', 333],
203 'abstract' => ['text', ''],
204 'extro' => ['text', ''],
205 'gallery' => ['integer', false]
206 ];
207
208 $this->db
209 ->expects($this->once())
210 ->method('quote')
211 ->with(333, 'integer')
212 ->willReturn('333')
213 ;
214 $return_statement = $this->getMockBuilder(ilDBStatement::class)->getMock();
215 $this->db
216 ->expects($this->once())
217 ->method('query')
218 ->with($sql)
219 ->willReturn($return_statement)
220 ;
221 $this->db
222 ->expects($this->once())
223 ->method('numRows')
224 ->willReturn(0)
225 ;
226 $this->db
227 ->expects($this->once())
228 ->method('insert')
229 ->with('lso_settings', $values)
230 ;
231
233 $result = $obj->getSettingsFor(333);
234
235 $this->assertEquals(333, $result->getObjId());
236 $this->assertEquals('', $result->getAbstract());
237 $this->assertEquals('', $result->getExtro());
238 $this->assertEquals('', $result->getAbstractImage());
239 $this->assertEquals('', $result->getExtroImage());
240 $this->assertEquals(false, $result->getMembersGallery());
241 }