/** * @test */ public function it_displays_an_error_for_unresolved_characters() { $this->container['repository.test'] = new InMemoryRepository(); $this->commandTester->execute(['command' => SearchCommand::COMMAND_NAME, '--from' => 'test', 'codepoint' => '1']); $output = $this->commandTester->getDisplay(); $statusCode = $this->commandTester->getStatusCode(); ha::assertThat('output', $output, hm::containsString('Character Not Found')); ha::assertThat('status code', $statusCode, hm::is(hm::identicalTo(1))); }
/** * @test */ public function it_displays_characters_residing_in_a_supplied_script() { $repository = new InMemoryRepository(); $codepoint = Codepoint::fromInt(97); $script = Script::fromValue(Script::LATIN); $character = $this->buildCharacterWithCodepoint($codepoint, null, null, $script); $characters = Collection::fromArray([$character]); $repository->addMany($characters); $this->container['repository.test'] = $repository; $this->commandTester->execute(['command' => PropertiesCommand::COMMAND_NAME, '--from' => 'test', 'property-type' => PropertiesCommand::PROPERTY_SCRIPT, 'value' => $script->getValue()]); $output = $this->commandTester->getDisplay(); $statusCode = $this->commandTester->getStatusCode(); ha::assertThat('output', $output, hm::containsString('U+61:')); ha::assertThat('status code', $statusCode, hm::is(hm::identicalTo(0))); }
/** * @test */ public function it_transfers_characters_from_one_repository_to_another() { $codepoint = Codepoint::fromInt(1); $character = $this->buildCharacterWithCodepoint($codepoint); $characters = Collection::fromArray([$character]); $source = new InMemoryRepository(); $source->addMany($characters); $destination = new InMemoryRepository(); $this->container['repository.test-source'] = $source; $this->container['repository.test-destination'] = $destination; ha::assertThat(count($source), hm::is(hm::identicalTo(1))); ha::assertThat(count($destination), hm::is(hm::identicalTo(0))); $this->commandTester->execute(['command' => RepositoryTransferCommand::COMMAND_NAME, 'from' => 'test-source', 'to' => 'test-destination']); ha::assertThat(count($source), hm::is(hm::identicalTo(1))); ha::assertThat(count($destination), hm::is(hm::identicalTo(1))); $output = $this->commandTester->getDisplay(); $statusCode = $this->commandTester->getStatusCode(); ha::assertThat('output', $output, hm::containsString('Database Generated')); ha::assertThat('status code', $statusCode, hm::is(hm::identicalTo(0))); }
/** * @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))); }
public function testFixtureApi_WhenEventIsPublishedToEventBus() { $aggregate1 = Uuid::uuid1()->toString(); $aggregate2 = Uuid::uuid1()->toString(); $fixture = new AnnotatedSagaTestFixture(StubSaga::class); $validator = $fixture->givenAggregate($aggregate1)->published(array(new TriggerSagaStartEvent($aggregate1), new TriggerExistingSagaEvent($aggregate1)))->whenAggregate($aggregate1)->publishes(new TriggerExistingSagaEvent($aggregate1)); $validator->expectActiveSagas(1); $validator->expectAssociationWith("identifier", $aggregate1); $validator->expectNoAssociationWith("identifier", $aggregate2); //validator.expectScheduledEventMatching(Duration.standardMinutes(10), // Matchers.messageWithPayload(CoreMatchers.any(Object.class))); $validator->expectDispatchedCommandsEqualTo(array()); $validator->expectPublishedEventsMatching(Matchers::listWithAnyOf(array(Matchers::messageWithPayload(CoreMatchers::any(SagaWasTriggeredEvent::class))))); }
/** * @Then /^The Consumer "([^"]*)" has been called once with message "([^"]*)"$/ */ public function theConsumerHasBeenCalledOnceWithMessage($consumerId, $message) { $consumerCalls = $this->getContainer()->get($consumerId)->getCallback()[0]->getExecuteCalls(); ha::assertThat(count($consumerCalls), hm::is(hm::identicalTo(1))); ha::assertThat($message, hm::is(hm::identicalTo($consumerCalls[0]->body))); }
/** * Matches when the given value does not match the parameter * @param $value * @return null */ public static function not($value) { return self::getPoserCore()->reportMatcher(hm::not($value))->returnNull(); }