65 : void
66 {
67 $rcid = new ResourceCollectionIdentification(self::DUMMY_RCID);
68
69 $this->collection_repo->expects($this->once())
70 ->method('existing')
71 ->with($rcid)
72 ->willReturn(
73 new ResourceCollection($rcid, -1, '')
74 );
75
76 $this->collection_repo->expects($this->once())
77 ->method('getResourceIdStrings')
78 ->with($rcid)
79 ->willReturn(
81 'rid1',
82 'rid2',
83 'rid3'
84 ])
85 );
86
87 $consecutive = [
88 new ResourceIdentification('rid1'),
89 new ResourceIdentification('rid2'),
90 new ResourceIdentification('rid3'),
91 new ResourceIdentification('rid1'),
92 new ResourceIdentification('rid2'),
93 new ResourceIdentification('rid3'),
94 ];
95 $this->resource_builder
96 ->expects($this->exactly(6))
97 ->method('has')
98 ->willReturnCallback(
99 function ($rid) use (&$consecutive): true {
100 $this->assertEquals(array_shift($consecutive), $rid);
101 return true;
102 }
103 );
104
105 $collection = $this->collections->get($rcid, null);
106
107 $this->assertInstanceOf(ResourceCollection::class, $collection);
108 $this->assertNotInstanceOf(MockObject::class, $collection);
109
110 $this->assertSame(3, $collection->count());
111
112 $collection = $this->collections->get($rcid, null);
113
114 $this->assertSame(3, $collection->count());
115 }
arrayAsGenerator(array $array)