public function __construct() { $routingConfigFile = __DIR__ . '/../../../../../../../src-dev/sample-application/config/routing.php'; $diConfigFile = __DIR__ . '/../../../../../../../src-dev/sample-application/config/di.php'; $containerWithControllers = new Container(); $containerWithControllers->configureFromFile($diConfigFile); $this->application = Application::factory([$routingConfigFile], $containerWithControllers); }
public function setUp() { $container = new Container(); $container->configureFromFile(__DIR__ . '/../../../../../config/di.php'); $this->routingManager = $container->get('sainsburys.sainsburys-http-service.routing-manager'); $this->slimAppAdapter = $container->get('sainsburys.sainsburys-http-service.slim-app-adapter'); $this->slimApp = $container->get('sainsburys.sainsburys-http-service.slim-app'); }
public static function factory(array $routingConfigFiles, ContainerInterface $containerWithControllers) : Application { $containerWithFramework = new Container(); $containerWithFramework->configureFromFile(__DIR__ . '/../../../config/di.php'); $application = $containerWithFramework->get('sainsburys.sainsburys-http-service.application'); /** @var $application Application */ $application->takeRoutingConfigs($routingConfigFiles, $containerWithControllers); return $application; }
public function testDiConfig() { // ARRANGE $container = new Container(); $container->configureFromFile(__DIR__ . '/../../../../../config/di.php'); // ACT $result = $container->get('sainsburys.sainsburys-http-service.application'); // ASSERT $this->assertInstanceOf(Application::class, $result); }
<?php require_once __DIR__ . '/../../../vendor/autoload.php'; use Sainsburys\HttpService\Application; use UltraLite\Container\Container; $routingConfigFiles = [__DIR__ . '/../config/routing.php']; $diConfigFile = __DIR__ . '/../config/di.php'; $containerWithControllers = new Container(); $containerWithControllers->configureFromFile($diConfigFile); $application = Application::factory($routingConfigFiles, $containerWithControllers); $application->run();
/** * @When I tell the container to read the config file at :pathToConfigFile */ public function iTellTheContainerToReadTheConfigFileAt($pathToConfigFile) { $this->container->configureFromFile($pathToConfigFile); }