Inheritance: implements Phprest\Service\Configurable
Exemple #1
0
 public function testInstansiation()
 {
     $service = new Service();
     $service->register($this->continer, new Config('sampleLoggerName'));
     $loggerService = $this->continer->get(Config::getServiceName());
     $this->assertEquals('sampleLoggerName', $loggerService->getName());
 }
Exemple #2
0
 public function testInstantiation()
 {
     $this->assertTrue($this->app->getContainer()->isSingleton(Service\Hateoas\Config::getServiceName()));
     $this->assertTrue($this->app->getContainer()->isSingleton(Service\Logger\Config::getServiceName()));
     $this->assertEquals('phprest-test', $this->app->getContainer()->get(Application::CONTAINER_ID_VENDOR));
     $this->assertEquals(1, $this->app->getContainer()->get(Application::CONTAINER_ID_API_VERSION));
     $this->assertTrue($this->app->getContainer()->get(Application::CONTAINER_ID_DEBUG));
     $this->assertInstanceOf('\\Phprest\\Router\\RouteCollection', $this->app->getContainer()->get(Application::CONTAINER_ID_ROUTER));
 }
<?php

use Phprest\Service\Logger\Config as LoggerConfig;
use Monolog\Handler\StreamHandler;
/** @var \Phprest\Application $app */
/** @var \Monolog\Logger $logger */
$logger = $app->getContainer()->get(LoggerConfig::getServiceName());
$logger->pushHandler(new StreamHandler(__DIR__ . '/../storage/log', \Monolog\Logger::DEBUG));