예제 #1
0
 /**
  * @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)));
 }
예제 #2
0
 /**
  * @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)));
 }
예제 #4
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)));
 }
 /**
  * @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)));
 }