remove usage of getenv from codebase (#1861)
This commit is contained in:
@@ -19,21 +19,20 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
*/
|
||||
class CreateReleaseCommandTest extends KernelTestCase
|
||||
{
|
||||
/**
|
||||
* @var Application
|
||||
*/
|
||||
protected $application;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$this->application->add(new CreateReleaseCommand(realpath(__DIR__ . '/../../')));
|
||||
}
|
||||
|
||||
public function testCommandName()
|
||||
{
|
||||
$command = $this->application->find('kimai:create-release');
|
||||
$kernel = self::bootKernel(['environment' => 'test']);
|
||||
$application = new Application($kernel);
|
||||
$application->add(new CreateReleaseCommand(realpath(__DIR__ . '/../../'), 'test'));
|
||||
|
||||
$command = $application->find('kimai:create-release');
|
||||
self::assertTrue($command->isEnabled());
|
||||
self::assertInstanceOf(CreateReleaseCommand::class, $command);
|
||||
}
|
||||
|
||||
public function testCommandNameIsNotAvailableInProd()
|
||||
{
|
||||
$command = new CreateReleaseCommand(realpath(__DIR__ . '/../../'), 'prod');
|
||||
self::assertFalse($command->isEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,21 +19,19 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
*/
|
||||
class ResetCommandTest extends KernelTestCase
|
||||
{
|
||||
/**
|
||||
* @var Application
|
||||
*/
|
||||
protected $application;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$this->application->add(new ResetCommand());
|
||||
}
|
||||
|
||||
public function testCommandName()
|
||||
{
|
||||
$command = $this->application->find('kimai:reset-dev');
|
||||
$kernel = self::bootKernel();
|
||||
$application = new Application($kernel);
|
||||
$application->add(new ResetCommand('test'));
|
||||
|
||||
$command = $application->find('kimai:reset-dev');
|
||||
self::assertInstanceOf(ResetCommand::class, $command);
|
||||
}
|
||||
|
||||
public function testCommandNameIsNotEnabledInProd()
|
||||
{
|
||||
$command = new ResetCommand('prod');
|
||||
self::assertFalse($command->isEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,13 @@ class MailConfigurationTest extends TestCase
|
||||
{
|
||||
public function testGetFromAddress()
|
||||
{
|
||||
$previous = getenv('MAILER_FROM');
|
||||
putenv('MAILER_FROM=foo-bar123@example.com');
|
||||
|
||||
$sut = new MailConfiguration();
|
||||
$sut = new MailConfiguration('foo-bar123@example.com');
|
||||
self::assertEquals('foo-bar123@example.com', $sut->getFromAddress());
|
||||
}
|
||||
|
||||
putenv('MAILER_FROM=');
|
||||
public function testGetFromAddressWithEmptyAddressReturnsNull()
|
||||
{
|
||||
$sut = new MailConfiguration('');
|
||||
self::assertNull($sut->getFromAddress());
|
||||
|
||||
putenv('MAILER_FROM=' . $previous);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,6 @@ class DoctorControllerTest extends ControllerBaseTest
|
||||
$this->assertAccessIsGranted($client, '/doctor');
|
||||
|
||||
$result = $client->getCrawler()->filter('.content .box-header');
|
||||
$this->assertEquals(7, \count($result));
|
||||
self::assertCount(6, $result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user