Class CollectionTest.
More...
◆ setUp()
ILIAS\ResourceStorage\Resource\CollectionRepositoryTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 46 of file CollectionRepositoryTest.php.
48 $this->db_mock = $this->createMock(\ilDBInterface::class);
49 $this->repo =
new CollectionDBRepository($this->db_mock);
50 $this->rcid_generator =
new DummyIDGenerator(self::TEST_RCID);
◆ testStore()
ILIAS\ResourceStorage\Resource\CollectionRepositoryTest::testStore |
( |
| ) |
|
Definition at line 53 of file CollectionRepositoryTest.php.
55 $collection = $this->repo->blank($this->rcid_generator->getUniqueResourceCollectionIdentification());
56 $this->assertEquals(0, $collection->count());
59 $collection->add(
new ResourceIdentification($rid_one));
61 $collection->add(
new ResourceIdentification($rid_two));
63 $rids_given = [$rid_one, $rid_two];
64 $this->db_mock->expects($this->once())
66 ->with(
'rid', $rids_given,
true,
'text')
67 ->willReturn(
'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->once())
74 ->method(
'manipulateF')
75 ->with(
'DELETE FROM il_resource_rca WHERE rcid = %s AND rid NOT IN("rid_one", "rid_one")');
77 $this->db_mock->expects($this->exactly(3))
80 $this->onConsecutiveCalls(
81 $this->returnCallback(
function ($table, $fields):
int {
82 $this->assertEquals(
'il_resource_rca', $table);
85 $this->returnCallback(
function ($table, $fields):
int {
86 $this->assertEquals(
'il_resource_rca', $table);
89 $this->returnCallback(
function ($table, $fields):
int {
90 $this->assertEquals(
'il_resource_rc', $table);
96 $event_data_container =
new DataContainer();
97 $this->repo->update($collection, $event_data_container);
100 $this->assertCount(2, $event_data_container->get());
101 foreach ($event_data_container->get() as $event_data) {
102 $this->assertInstanceOf(CollectionData::class, $event_data);
103 $this->assertContains($event_data->getRid(), $rids_given);
104 $this->assertEquals(self::TEST_RCID, $event_data->getRcid());
◆ $db_mock
ilDBInterface MockObject ILIAS\ResourceStorage\Resource\CollectionRepositoryTest::$db_mock |
|
private |
◆ $rcid_generator
DummyIDGenerator ILIAS\ResourceStorage\Resource\CollectionRepositoryTest::$rcid_generator |
|
private |
◆ $repo
◆ TEST_RCID
const ILIAS\ResourceStorage\Resource\CollectionRepositoryTest::TEST_RCID = 'test_rcid' |
|
private |
The documentation for this class was generated from the following file: