Skip to content

Commit

Permalink
Update integration tests to use ConfigProvider
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksei Khudiakov <[email protected]>
  • Loading branch information
Xerkus committed Jun 12, 2020
1 parent 8e7ef4c commit d731040
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 120 deletions.
21 changes: 3 additions & 18 deletions test/Application/BadControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

use Laminas\Http\PhpEnvironment\Request;
use Laminas\Http\PhpEnvironment\Response;
use Laminas\Mvc\ConfigProvider;
use Laminas\Mvc\Controller\ControllerManager;
use Laminas\Mvc\Service\ServiceListenerFactory;
use Laminas\Mvc\Service\ServiceManagerConfig;
use Laminas\Router;
use Laminas\ServiceManager\ServiceManager;
use Laminas\Stdlib\ArrayUtils;
Expand Down Expand Up @@ -41,13 +40,8 @@ public function prepareApplication()
],
];

$serviceListener = new ServiceListenerFactory();
$r = new ReflectionProperty($serviceListener, 'defaultServiceConfig');
$r->setAccessible(true);
$serviceConfig = $r->getValue($serviceListener);

$serviceConfig = ArrayUtils::merge(
$serviceConfig,
(new ConfigProvider())->getDependencies(),
(new Router\ConfigProvider())->getDependencyConfig()
);

Expand Down Expand Up @@ -79,19 +73,10 @@ public function prepareApplication()
],
'services' => [
'config' => $config,
'ApplicationConfig' => [
'modules' => [],
'module_listener_options' => [
'config_cache_enabled' => false,
'cache_dir' => 'data/cache',
'module_paths' => [],
],
],
],
]
);
$services = new ServiceManager();
(new ServiceManagerConfig($serviceConfig))->configureServiceManager($services);
$services = new ServiceManager($serviceConfig);
$application = $services->get('Application');

$request = $services->get('Request');
Expand Down
46 changes: 0 additions & 46 deletions test/Application/InitializationIntegrationTest.php

This file was deleted.

21 changes: 3 additions & 18 deletions test/Application/InvalidControllerTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

use Laminas\Http\PhpEnvironment\Request;
use Laminas\Http\PhpEnvironment\Response;
use Laminas\Mvc\ConfigProvider;
use Laminas\Mvc\Controller\ControllerManager;
use Laminas\Mvc\Service\ServiceListenerFactory;
use Laminas\Mvc\Service\ServiceManagerConfig;
use Laminas\Router;
use Laminas\ServiceManager\ServiceManager;
use Laminas\Stdlib\ArrayUtils;
Expand Down Expand Up @@ -41,13 +40,8 @@ public function prepareApplication()
],
];

$serviceListener = new ServiceListenerFactory();
$r = new ReflectionProperty($serviceListener, 'defaultServiceConfig');
$r->setAccessible(true);
$serviceConfig = $r->getValue($serviceListener);

$serviceConfig = ArrayUtils::merge(
$serviceConfig,
(new ConfigProvider())->getDependencies(),
(new Router\ConfigProvider())->getDependencyConfig()
);

Expand Down Expand Up @@ -78,19 +72,10 @@ public function prepareApplication()
],
'services' => [
'config' => $config,
'ApplicationConfig' => [
'modules' => [],
'module_listener_options' => [
'config_cache_enabled' => false,
'cache_dir' => 'data/cache',
'module_paths' => [],
],
],
],
]
);
$services = new ServiceManager();
(new ServiceManagerConfig($serviceConfig))->configureServiceManager($services);
$services = new ServiceManager($serviceConfig);
$application = $services->get('Application');

$request = $services->get('Request');
Expand Down
21 changes: 3 additions & 18 deletions test/Application/MissingControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

use Laminas\Http\PhpEnvironment\Request;
use Laminas\Http\PhpEnvironment\Response;
use Laminas\Mvc\Service\ServiceListenerFactory;
use Laminas\Mvc\Service\ServiceManagerConfig;
use Laminas\Mvc\ConfigProvider;
use Laminas\Router;
use Laminas\ServiceManager\ServiceManager;
use Laminas\Stdlib\ArrayUtils;
Expand Down Expand Up @@ -39,13 +38,8 @@ public function prepareApplication()
],
];

$serviceListener = new ServiceListenerFactory();
$r = new ReflectionProperty($serviceListener, 'defaultServiceConfig');
$r->setAccessible(true);
$serviceConfig = $r->getValue($serviceListener);

$serviceConfig = ArrayUtils::merge(
$serviceConfig,
(new ConfigProvider())->getDependencies(),
(new Router\ConfigProvider())->getDependencyConfig()
);

Expand All @@ -66,19 +60,10 @@ public function prepareApplication()
],
'services' => [
'config' => $config,
'ApplicationConfig' => [
'modules' => [],
'module_listener_options' => [
'config_cache_enabled' => false,
'cache_dir' => 'data/cache',
'module_paths' => [],
],
],
],
]
);
$services = new ServiceManager();
(new ServiceManagerConfig($serviceConfig))->configureServiceManager($services);
$services = new ServiceManager($serviceConfig);
$application = $services->get('Application');

$request = $services->get('Request');
Expand Down
23 changes: 3 additions & 20 deletions test/Application/PathControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

use Laminas\Http\PhpEnvironment\Request;
use Laminas\Http\PhpEnvironment\Response;
use Laminas\Mvc\ConfigProvider;
use Laminas\Mvc\Controller\ControllerManager;
use Laminas\Mvc\Service\ServiceListenerFactory;
use Laminas\Mvc\Service\ServiceManagerConfig;
use Laminas\Router;
use Laminas\ServiceManager\ServiceManager;
use Laminas\Stdlib\ArrayUtils;
Expand All @@ -39,13 +38,8 @@ public function prepareApplication()
],
];

$serviceListener = new ServiceListenerFactory();
$r = new ReflectionProperty($serviceListener, 'defaultServiceConfig');
$r->setAccessible(true);
$serviceConfig = $r->getValue($serviceListener);

$serviceConfig = ArrayUtils::merge(
$serviceConfig,
(new ConfigProvider())->getDependencies(),
(new Router\ConfigProvider())->getDependencyConfig()
);

Expand Down Expand Up @@ -77,21 +71,10 @@ public function prepareApplication()
],
'services' => [
'config' => $config,
'ApplicationConfig' => [
'modules' => [
'Laminas\Router',
],
'module_listener_options' => [
'config_cache_enabled' => false,
'cache_dir' => 'data/cache',
'module_paths' => [],
],
],
],
]
);
$services = new ServiceManager();
(new ServiceManagerConfig($serviceConfig))->configureServiceManager($services);
$services = new ServiceManager($serviceConfig);
$application = $services->get('Application');

$request = $services->get('Request');
Expand Down

0 comments on commit d731040

Please sign in to comment.