testCategoryPresetProviderMock = $this->createMock(TestCategoryPresetProvider::class); $this->testCategoryPresetMock = $this->createMock(TestCategoryPreset::class); $this->subject = new TestCategoryPresetMap( $this->testCategoryPresetProviderMock ); } public function testGetMap(): void { $this->testCategoryPresetProviderMock ->expects($this->once()) ->method('findPresetGroupOrFail') ->willReturn([ 'presets' => [ $this->testCategoryPresetMock ] ]); $this->testCategoryPresetMock ->expects($this->once()) ->method('getId') ->willReturn('presetId'); $this->testCategoryPresetMock ->expects($this->once()) ->method('getQtiCategory') ->willReturn('qtiCategory'); $this->assertSame([ ['presetId' => 'qtiCategory'] ], $this->subject->getMap()); } public function testGetMapEmpty(): void { $this->testCategoryPresetProviderMock ->expects($this->once()) ->method('findPresetGroupOrFail') ->willReturn([ 'presets' => [] ]); $this->assertSame([], $this->subject->getMap()); } }