21 require_once(__DIR__ .
'/../DummyIDGenerator.php');
38 private \ilDBInterface|\PHPUnit\Framework\MockObject\MockObject
$db_mock;
41 protected function setUp(): void
43 $this->db_mock = $this->createMock(\ilDBInterface::class);
50 $collection = $this->repo->blank($this->rcid_generator->getUniqueResourceCollectionIdentification());
51 $this->assertEquals(0, $collection->count());
58 $rids_given = [$rid_one, $rid_two];
59 $this->db_mock->expects($this->once())
61 ->with(
'rid', $rids_given,
true,
'text')
62 ->willReturn(
'rid NOT IN("rid_one", "rid_one")');
64 $this->db_mock->expects($this->once())
65 ->method(
'manipulateF')
66 ->with(
'DELETE FROM il_resource_rca WHERE rcid = %s AND rid NOT IN("rid_one", "rid_one")');
68 $this->db_mock->expects($this->once())
69 ->method(
'manipulateF')
70 ->with(
'DELETE FROM il_resource_rca WHERE rcid = %s AND rid NOT IN("rid_one", "rid_one")');
72 $this->db_mock->expects($this->exactly(3))
75 $this->onConsecutiveCalls(
76 $this->returnCallback(
function ($table, $fields) {
77 $this->assertEquals(
'il_resource_rca', $table);
80 $this->returnCallback(
function ($table, $fields) {
81 $this->assertEquals(
'il_resource_rca', $table);
84 $this->returnCallback(
function ($table, $fields) {
85 $this->assertEquals(
'il_resource_rc', $table);
92 $this->repo->update($collection, $event_data_container);
95 $this->assertCount(2, $event_data_container->get());
96 foreach ($event_data_container->get() as $event_data) {
97 $this->assertInstanceOf(CollectionData::class, $event_data);
98 $this->assertContains($event_data->getRid(), $rids_given);
99 $this->assertEquals(self::TEST_RCID, $event_data->getRcid());
Class CollectionDBRepository.
Class ResourceIdentification.
ilDBInterface PHPUnit Framework MockObject MockObject $db_mock
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
CollectionDBRepository $repo