Skip to content

Commit

Permalink
Refactor Injector instantiation and streamline bootstrap
Browse files Browse the repository at this point in the history
Removed the `$_ENV['TMP_DIR']` parameter from `Injector` instantiation in tests for cleaner initiation. Updated `phpunit.xml.dist` to use a more standard bootstrap path, improving configuration consistency.
  • Loading branch information
koriym committed Nov 21, 2024
1 parent 64cf9e2 commit 924c238
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php">
bootstrap="vendor/autoload.php">
<coverage processUncoveredFiles="true" cacheDirectory="./.phpunit-cache">
<include>
<directory suffix=".php">src</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/FastlyEnableSoftPurgeModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
final class FastlyEnableSoftPurgeModule extends AbstractModule
{
/**
* {@inheritdoc}
* {@inheritDoc}
*/
protected function configure(): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/FastlyPurgeModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
parent::__construct($module);
}

/** {@inheritdoc} */
/** {@inheritDoc} */
protected function configure(): void
{
$this->bind(Configuration::class)->annotatedWith(Configuration::class)->toInstance(
Expand Down
5 changes: 2 additions & 3 deletions tests/FastlyPurgeModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FastlyPurgeModuleTest extends TestCase
public function testModule(): void
{
$module = new FastlyPurgeModule('apiKey', 'serviceId');
$injector = new Injector($module, $_ENV['TMP_DIR']);
$injector = new Injector($module);

$this->assertInstanceOf(PurgeApi::class, $injector->getInstance(PurgeApi::class));
$this->assertInstanceOf(FastlyCachePurgerInterface::class, $injector->getInstance(FastlyCachePurgerInterface::class));
Expand All @@ -26,9 +26,8 @@ public function testPurge(): void
$module = new FastlyPurgeModule('apiKey', 'serviceId');
$module->override(new FakeFastlyPurgeModule());

$injector = new Injector($module, $_ENV['TMP_DIR']);
$injector = new Injector($module);
$cachePurger = $injector->getInstance(FastlyCachePurgerInterface::class);
assert($cachePurger instanceof FastlyCachePurgerInterface);
($cachePurger)('fakeTag');

$purgeApi = $injector->getInstance(PurgeApi::class);
Expand Down
3 changes: 1 addition & 2 deletions tests/FastlySoftPurgeModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ public function testSoftPurge(): void
$module = new FastlyPurgeModule('apiKey', 'serviceId');
$module->override(new FastlyEnableSoftPurgeModule(new FakeFastlyPurgeModule()));

$injector = new Injector($module, $_ENV['TMP_DIR']);
$injector = new Injector($module);
$cachePurger = $injector->getInstance(FastlyCachePurgerInterface::class);
assert($cachePurger instanceof FastlyCachePurgerInterface);
($cachePurger)('fakeTag');

$purgeApi = $injector->getInstance(PurgeApi::class);
Expand Down
13 changes: 0 additions & 13 deletions tests/bootstrap.php

This file was deleted.

0 comments on commit 924c238

Please sign in to comment.