Esempio n. 1
0
 public function test_that_query_is_handled_by_pipeline()
 {
     $handler = new UserByEmailHandler();
     $this->queryMap->registerHandlers([UserByEmailQuery::class => $handler]);
     $query = new UserByEmailQuery('*****@*****.**');
     $user = $this->pipeline->fetch($query);
     $this->assertTrue($this->queryMap->hasHandler(UserByEmailQuery::class) && $this->logHandler->hasInfoThatContains(sprintf('Query received {%s}', ClassName::canonical(UserByEmailQuery::class))) && $this->logHandler->hasInfoThatContains(sprintf('Query handled {%s}', ClassName::canonical(UserByEmailQuery::class))) && $user['email'] === '*****@*****.**');
 }
Esempio n. 2
0
 public function test_that_command_is_executed_by_pipeline()
 {
     $handler = new RegisterUserHandler();
     $this->commandMap->registerHandlers([RegisterUserCommand::class => $handler]);
     $command = new RegisterUserCommand();
     $command->setFirstName('James')->setMiddleName('D')->setLastName('Smith')->setEmail('*****@*****.**')->setPassword('secret');
     $this->pipeline->execute($command);
     $this->assertTrue($this->commandMap->hasHandler(RegisterUserCommand::class) && $this->logHandler->hasInfoThatContains(sprintf('Command received {%s}', ClassName::canonical(RegisterUserCommand::class))) && $this->logHandler->hasInfoThatContains(sprintf('Command handled {%s}', ClassName::canonical(RegisterUserCommand::class))) && $handler->isHandled());
 }
 function testRefreshingExistingCache()
 {
     $client = $this->prepare([new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/profile.json')), new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/profile.json')), new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/profile.json'))], array_merge($this->conf(), ['cache' => true]));
     $req = Client\Request\Factory::create('profile');
     $result = $client->request(Client\Request\Factory::create('profile'));
     $req = Client\Request\Factory::create('profile');
     $req->setUseCache(false);
     $result = $client->request($req);
     $this->assertTrue($this->loghandler->hasInfoThatContains('Refreshing cache'));
 }
 /**
  * Test instance with Monolog passed.
  *
  * @throws \WebservicesNl\Common\Exception\Client\InputException
  * @throws \InvalidArgumentException
  * @throws \WebservicesNl\Common\Exception\Server\NoServerAvailableException
  */
 public function testInstanceWithLogger()
 {
     $handler = new TestHandler();
     $logger = new Logger('unit-test', [$handler]);
     $config = new PlatformConfig();
     $factory = SoapFactory::build($config);
     $factory->setLogger($logger);
     $soapClient = $factory->create(['username' => 'johndoe', 'password' => 'fakePassword']);
     static::assertAttributeInstanceOf('\\Psr\\Log\\LoggerInterface', 'logger', $factory);
     static::assertTrue($factory->hasLogger());
     static::assertAttributeInstanceOf('\\Psr\\Log\\LoggerInterface', 'logger', $soapClient);
     static::assertTrue($handler->hasInfoThatContains('Created SoapClient for Webservices'));
     static::assertTrue($handler->hasDebugThatContains('Created SoapClient'));
     static::assertInstanceOf('WebservicesNl\\Protocol\\Soap\\Config\\Platform\\Webservices\\Converter', $soapClient->getConverter());
 }
Esempio n. 5
0
 public function test_that_event_is_logged_by_subscriber()
 {
     $event = new UserRegisteredEvent('*****@*****.**', 'James', 'Smith', 'D');
     $this->dispatcher->dispatch($event);
     $this->assertTrue($this->logHandler->hasInfoThatContains(sprintf('Event dispatched {%s}', ClassName::canonical(UserRegisteredEvent::class))));
 }