/** * @test */ public function it_can_be_added_to_if_writable() { if (!$this->repository instanceof WritableRepository) { $this->markTestSkipped('Repository is not writable'); } $codepoint = Codepoint::fromInt(1); $addCharacter = $this->buildCharacterWithCodepoint($codepoint); $addCharacters = Character\Collection::fromArray([$addCharacter]); $this->repository->addMany($addCharacters); $character = $this->repository->getByCodepoint($codepoint); ha::assertThat('character', $character, hm::is(hm::equalTo($addCharacter))); ha::assertThat('count', count($this->repository), hm::is(hm::equalTo(2))); }
/** * {@inheritDoc} */ public function getByCodepoint(Codepoint $codepoint) { $this->logMethodCall(__FUNCTION__, [$codepoint]); return $this->delegate->getByCodepoint($codepoint); }
/** * @param Codepoint $codepoint * @return CodepointAssigned * @throws CharacterNotFoundException * @throws InvalidArgumentException * @throws OutOfRangeException */ public function getByCodepoint(Codepoint $codepoint) { return $this->sourceRepository->getByCodepoint($codepoint); }
public function it_throws_CharacterNotFoundException_if_something_other_than_a_character_is_assigned_to_a_codepoint(Surrogate $surrogate) { $this->repository->getByCodepoint(Argument::any())->willReturn($surrogate); $this->shouldThrow(CharacterNotFoundException::class)->duringGetCharacterByCodepoint(Codepoint::fromInt(1)); }