21 require_once(__DIR__ .
'/../DummyIDGenerator.php');
38 private \ilDBInterface|\PHPUnit\Framework\MockObject\MockObject
$db_mock;
42 protected function setUp(): void
44 $this->db_mock = $this->createMock(\ilDBInterface::class);
51 $collection = $this->repo->blank($this->rcid_generator->getUniqueResourceCollectionIdentification());
52 $this->assertEquals(0, $collection->count());
59 $rids_given = [$rid_one, $rid_two];
60 $this->db_mock->expects($this->once())
62 ->with(
'rid', $rids_given,
true,
'text')
63 ->willReturn(
'rid NOT IN("rid_one", "rid_one")');
65 $this->db_mock->expects($this->once())
66 ->method(
'manipulateF')
67 ->with(
'DELETE FROM il_resource_rca WHERE rcid = %s AND rid NOT IN("rid_one", "rid_one")');
69 $this->db_mock->expects($this->once())
70 ->method(
'manipulateF')
71 ->with(
'DELETE FROM il_resource_rca WHERE rcid = %s AND rid NOT IN("rid_one", "rid_one")');
73 $this->db_mock->expects($this->exactly(3))
76 $this->onConsecutiveCalls(
77 $this->returnCallback(
function ($table, $fields) {
78 $this->assertEquals(
'il_resource_rca', $table);
81 $this->returnCallback(
function ($table, $fields) {
82 $this->assertEquals(
'il_resource_rca', $table);
85 $this->returnCallback(
function ($table, $fields) {
86 $this->assertEquals(
'il_resource_rc', $table);
93 $this->repo->update($collection, $event_data_container);
96 $this->assertCount(2, $event_data_container->get());
97 foreach ($event_data_container->get() as $event_data) {
98 $this->assertInstanceOf(CollectionData::class, $event_data);
99 $this->assertContains($event_data->getRid(), $rids_given);
100 $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
DummyIDGenerator $rcid_generator