23 require_once(__DIR__ .
'/../DummyIDGenerator.php');
43 protected function setUp(): void
45 $this->db_mock = $this->createMock(\ilDBInterface::class);
52 $collection = $this->repo->blank($this->rcid_generator->getUniqueResourceCollectionIdentification());
53 $this->assertSame(0, $collection->count());
60 $rids_given = [$rid_one, $rid_two];
61 $this->db_mock->expects($this->once())
63 ->with(
'rid', $rids_given,
true,
'text')
64 ->willReturn(
'rid NOT IN("rid_one", "rid_one")');
66 $this->db_mock->expects($this->once())
67 ->method(
'manipulateF')
68 ->with(
'DELETE FROM il_resource_rca WHERE rcid = %s AND rid NOT IN("rid_one", "rid_one")');
70 $this->db_mock->expects($this->once())
71 ->method(
'manipulateF')
72 ->with(
'DELETE FROM il_resource_rca WHERE rcid = %s AND rid NOT IN("rid_one", "rid_one")');
74 $called_table_names = [
80 $this->db_mock->expects($this->exactly(3))
83 function ($table_name) use (&$called_table_names):
int {
84 $expected_table_name = array_shift($called_table_names);
85 TestCase::assertSame($expected_table_name, $table_name);
91 $this->repo->update($collection, $event_data_container);
92 $this->assertCount(2, $event_data_container->get());
93 foreach ($event_data_container->get() as $event_data) {
94 $this->assertInstanceOf(CollectionData::class, $event_data);
95 $this->assertContains($event_data->getRid(), $rids_given);
96 $this->assertSame(self::TEST_RCID, $event_data->getRcid());
Class CollectionDBRepository.
Class ResourceIdentification.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
CollectionDBRepository $repo
DummyIDGenerator $rcid_generator