Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Sets the value of an environment variable
<?php putenv(string $assignment): bool
<?php     protected function tearDown(): void

    {

        unset($_ENV['FOO'], $_SERVER['FOO']);

        putenv('FOO');

        m::close();

    }
<?php     {

        parent::tearDown();



        putenv('ARTISAN_DOCS_ASK_STRATEGY');

        putenv('ARTISAN_DOCS_OPEN_STRATEGY');

    }
<?php         parent::tearDown();



        putenv('ARTISAN_DOCS_ASK_STRATEGY');

        putenv('ARTISAN_DOCS_OPEN_STRATEGY');

    }



    public function testItCanOpenTheLaravelDocumentation(): void
<?php     public function testItCanUseCustomAskStrategy()

    {

        putenv('ARTISAN_DOCS_ASK_STRATEGY='.__DIR__.'/fixtures/always-dusk-ask-strategy.php');



        $this->artisan('docs')

            ->expectsOutputToContain('Opening the docs to: https://laravel.com/docs/8.x/dusk')
<?php     public function testItFallsbackToAutocompleteWhenAskStrategyContainsBadSyntax(): void

    {

        putenv('ARTISAN_DOCS_ASK_STRATEGY='.__DIR__.'/fixtures/bad-syntax-strategy.php');



        $this->artisan('docs')

            ->expectsQuestion('Which page would you like to open?', 'laravel dusk')
<?php     public function testItFallsbackToAutocompleteWithBadAskStrategyReturnValue(): void

    {

        putenv('ARTISAN_DOCS_ASK_STRATEGY='.__DIR__.'/fixtures/bad-return-strategy.php');



        $this->artisan('docs')

            ->expectsQuestion('Which page would you like to open?', 'laravel dusk')
<?php     public function testItCatchesAndHandlesProcessInterruptExceptionsInAskStrategies()

    {

        putenv('ARTISAN_DOCS_ASK_STRATEGY='.__DIR__.'/fixtures/process-interrupt-strategy.php');



        $this->artisan('docs')->assertExitCode(130);

    }
<?php     public function testItBubblesUpAskStrategyExceptions()

    {

        putenv('ARTISAN_DOCS_ASK_STRATEGY='.__DIR__.'/fixtures/exception-throwing-strategy.php');



        $this->expectException(RuntimeException::class);

        $this->expectExceptionMessage('strategy failed');
<?php     public function testItBubblesUpNonProcessInterruptExceptionsInAskStrategies()

    {

        putenv('ARTISAN_DOCS_ASK_STRATEGY='.__DIR__.'/fixtures/process-failure-strategy.php');



        $this->expectException(ProcessFailedException::class);
<?php     public function testItCanSpecifyCustomOpenCommandsViaEnvVariables()

    {

        $GLOBALS['open-strategy-output-path'] = __DIR__.'/output.txt';

        putenv('ARTISAN_DOCS_OPEN_STRATEGY='.__DIR__.'/fixtures/open-strategy.php');

        $this->app[Kernel::class]->registerCommand($this->command()->setUrlOpener(null));



        @unlink($GLOBALS['open-strategy-output-path']);
<?php     public function testItHandlesBadSyntaxInOpeners()

    {

        putenv('ARTISAN_DOCS_OPEN_STRATEGY='.__DIR__.'/fixtures/bad-syntax-strategy.php');

        $this->app[Kernel::class]->registerCommand($this->command()->setUrlOpener(null));



        $this->artisan('docs installation')
<?php     public function testItHandlesBadReturnTypesInOpeners()

    {

        putenv('ARTISAN_DOCS_OPEN_STRATEGY='.__DIR__.'/fixtures/bad-return-strategy.php');

        $this->app[Kernel::class]->registerCommand($this->command()->setUrlOpener(null));



        $this->artisan('docs installation')
<?php     {

        parent::tearDown();



        putenv('SHELL_VERBOSITY');



        ScheduleListCommand::resolveTerminalWidthUsing(null);

    }
<?php     {

        parent::setUp();



        putenv('COLUMNS=64');

    }



    public function testDisplayConfig()