Skip to content

Commit

Permalink
build: use dotenv for test environment (#194)
Browse files Browse the repository at this point in the history
* build: use dotenv for test environment

* fix
  • Loading branch information
priyadi authored Oct 1, 2024
1 parent 0431075 commit 44136ac
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 28 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_ENV=test
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* refactor: saner metadata factory organization
* fix: target property that is unalterable & not mutable by the host should be
skipped
* build: use dotenv for test environment

## 1.9.0

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"ramsey/uuid": "^3.0 || ^4.0",
"rector/rector": "^1.2",
"symfony/debug-bundle": "^6.4 || ^7.0",
"symfony/dotenv": "^6.4 || ^7.0",
"symfony/framework-bundle": "^6.4 || ^7.0",
"symfony/http-kernel": "^6.4 || ^7.0",
"symfony/monolog-bundle": "^2.0 || ^3.0",
Expand Down
33 changes: 5 additions & 28 deletions tests/src/Common/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Rekalogika\Mapper\RekalogikaMapperBundle;
use Rekalogika\Mapper\Tests\PHPUnit\PHPUnitProfilerBundle;
use Rekalogika\Mapper\Tests\PHPUnit\TestRequest;
use Symfony\Bundle\DebugBundle\DebugBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
Expand All @@ -26,8 +25,6 @@
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Stopwatch\Stopwatch;

date_default_timezone_set('UTC');

Expand All @@ -40,7 +37,7 @@ class TestKernel extends Kernel
* @param array<string,mixed> $config
*/
public function __construct(
string $env = 'test',
private string $env = 'test',
bool $debug = true,
private readonly array $config = [],
) {
Expand Down Expand Up @@ -69,30 +66,10 @@ protected function build(ContainerBuilder $container): void

}

// public function boot(): void
// {
// parent::boot();

// dump(\debug_backtrace());
// }

// public function shutdown(): void
// {
// $stopwatch = $this->getContainer()->get('debug.stopwatch');
// assert($stopwatch instanceof Stopwatch);

// $request = new TestRequest();

// $profiler = $this->getContainer()->get('profiler');
// assert($profiler instanceof Profiler);

// $profile = $profiler->collect($request, $request->getResponse(), null);
// assert($profile !== null);

// $profiler->saveProfile($profile);

// parent::shutdown();
// }
public function getBuildDir(): string
{
return $this->getProjectDir() . '/var/build/' . $this->env;
}

#[\Override]
public function registerContainerConfiguration(LoaderInterface $loader): void
Expand Down

0 comments on commit 44136ac

Please sign in to comment.