[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.226.166.207: ~ $
<?php
declare(strict_types=1);

namespace PhpList\Core\Tests\Unit\Core;

use PhpList\Core\Core\Environment;
use PHPUnit\Framework\TestCase;

/**
 * Testcase.
 *
 * @author Oliver Klee <oliver@phplist.com>
 */
class EnvironmentTest extends TestCase
{
    /**
     * @test
     */
    public function defaultEnvironmentIsProduction()
    {
        static::assertSame(Environment::PRODUCTION, Environment::DEFAULT_ENVIRONMENT);
    }

    /**
     * @return string[][]
     */
    public function validEnvironmentDataProvider(): array
    {
        return [
            'Production' => [Environment::PRODUCTION],
            'Development' => [Environment::DEVELOPMENT],
            'Testing' => [Environment::TESTING],
        ];
    }

    /**
     * @test
     * @param string $environment
     * @dataProvider validEnvironmentDataProvider
     */
    public function validateEnvironmentForValidEnvironmentPasses(string $environment)
    {
        Environment::validateEnvironment($environment);

        // This is to avoid a warning in PHPUnit that this test has no assertions (as there is no assertion
        // for "no exception is thrown").
        static::assertTrue(true);
    }

    /**
     * @test
     */
    public function validateEnvironmentForInvalidEnvironmentThrowsException()
    {
        $environment = 'home';

        $this->expectException(\UnexpectedValueException::class);
        $this->expectExceptionMessage('$environment must be one of "prod", dev", test", but actually was: "home"');

        Environment::validateEnvironment($environment);
    }
}

Filemanager

Name Type Size Permission Actions
ApplicationKernelTest.php File 1.97 KB 0644
ApplicationStructureTest.php File 833 B 0644
BootstrapTest.php File 4.14 KB 0644
EnvironmentTest.php File 1.54 KB 0644