Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
</logging>
<php>
<env name="APP_NAME" value="Phenix"/>
<env name="APP_ENV" value="testing"/>
<env name="APP_ENV" value="local"/>
</php>
</phpunit>
</phpunit>
10 changes: 10 additions & 0 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ public static function path(): string
return self::$path;
}

public static function isLocal(): bool
{
return Config::get('app.env') === 'local';
}

public static function isProduction(): bool
{
return Config::get('app.env') === 'production';
}

public function swap(string $key, object $concrete): void
{
self::$container->extend($key)->setConcrete($concrete);
Expand Down
10 changes: 10 additions & 0 deletions tests/Unit/AppTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

use Phenix\App;

it('check if app is in local environment', function (): void {
expect(App::isLocal())->toBeTrue();
expect(App::isProduction())->toBeFalse();
});