Skip to content

Commit

Permalink
Fix test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Moln committed Sep 13, 2023
1 parent f52f20a commit 79360d6
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/Container/CallbackHandlerAbstractFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class CallbackHandlerAbstractFactory implements AbstractFactoryInterface
*/
public function canCreate(ContainerInterface $container, $requestedName)
{
// For resolve cycle create.
if ($requestedName === CallbackHandlerFactory::class) {
return false;
}
Expand Down
9 changes: 4 additions & 5 deletions src/Container/PreparerStackFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ class PreparerStackFactory

public function __invoke(ContainerInterface $container): ResultPreparableInterface
{
$preparer = new PreparerStack();
$preparer->push($container->get(DefaultPreparer::class));
$preparer->push($container->get(CommonPreparer::class));

return $preparer;
return new PreparerStack([
$container->get(DefaultPreparer::class),
$container->get(CommonPreparer::class),
]);
}
}
11 changes: 5 additions & 6 deletions src/Container/SerializationPreparerStackFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ class SerializationPreparerStackFactory

public function __invoke(ContainerInterface $container): ResultPreparableInterface
{
$preparer = new PreparerStack();
$preparer->push($container->get(DefaultPreparer::class));
$preparer->push($container->get(SerializationPreparer::class));
$preparer->push($container->get(CommonPreparer::class));

return $preparer;
return new PreparerStack([
$container->get(DefaultPreparer::class),
$container->get(SerializationPreparer::class),
$container->get(CommonPreparer::class),
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace ZfeggTest\PsrMvc\Factory;
namespace ZfeggTest\PsrMvc\Container;

use Zfegg\PsrMvc\CallbackHandler;
use Zfegg\PsrMvc\Container\CallbackHandlerAbstractFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace ZfeggTest\PsrMvc\Factory;
namespace ZfeggTest\PsrMvc\Container;

use Zfegg\PsrMvc\CallbackHandler;
use Zfegg\PsrMvc\Container\HandlerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace ZfeggTest\PsrMvc\Factory;
namespace ZfeggTest\PsrMvc\Container;

use ZfeggTest\PsrMvc\AbstractTestCase;

Expand Down
9 changes: 6 additions & 3 deletions test/Routing/RouteMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace ZfeggTest\PsrMvc\Routing;

use Laminas\Di\ConfigInterface;
use Zfegg\PsrMvc\Attribute\Route;
use Zfegg\PsrMvc\Routing\RouteMetadata;
use ZfeggTest\PsrMvc\Example\MvcExampleController;
Expand Down Expand Up @@ -42,11 +43,13 @@ public function testGetRoutes(): void

public function testGetRoutesFromCache(): void
{
$config = $this->container->get('config');

$file = tmpfile();
$path = stream_get_meta_data($file)['uri'];
$config[RouteMetadata::class]['cacheFile'] = $path;
$config = $this->container->get(ConfigInterface::class);
$config->setParameters(
RouteMetadata::class,
$config->getParameters(RouteMetadata::class) + ['cacheFile' => $path]
);
$routeMetadata = $this->container->get(RouteMetadata::class);
$metas = $routeMetadata->getRoutes();
$this->assertCount(8, $metas);
Expand Down

0 comments on commit 79360d6

Please sign in to comment.