/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Foundation/Bootstrap/LoadEnvironmentVariablesTest.php
52 строки
1 KB
Jason McCreary
[13.x] Mockery cleanup (#61117)
10 авг 2026, 20:23
Не верифицирован
10 авг 2026, 20:23
2ee40ee
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Foundation\Bootstrap; use Illuminate\Foundation\Application; use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; use Mockery; use PHPUnit\Framework\TestCase; class LoadEnvironmentVariablesTest extends TestCase { protected function tearDown(): void { unset($_ENV['FOO'], $_SERVER['FOO']); putenv('FOO'); } protected function getAppMock($file) { $app = Mockery::mock(Application::class); $app->expects('configurationIsCached') ->with()->andReturn(false); $app->expects('runningInConsole') ->with()->andReturn(false); $app->expects('environmentPath') ->with()->andReturn(__DIR__.'/../fixtures'); $app->expects('environmentFile') ->with()->andReturn($file); return $app; } public function testCanLoad() { $this->expectOutputString(''); (new LoadEnvironmentVariables)->bootstrap($this->getAppMock('.env')); $this->assertSame('BAR', env('FOO')); $this->assertSame('BAR', getenv('FOO')); $this->assertSame('BAR', $_ENV['FOO']); $this->assertSame('BAR', $_SERVER['FOO']); } public function testCanFailSilent() { $this->expectOutputString(''); (new LoadEnvironmentVariables)->bootstrap($this->getAppMock('BAD_FILE')); } }