function StatusCommandTest::testWithUrl
Same name and namespace in other branches
- main core/modules/system/tests/src/Kernel/Command/StatusCommandTest.php \Drupal\Tests\system\Kernel\Command\StatusCommandTest::testWithUrl()
Tests the example:command with the --url option forced into argv.
File
-
core/
modules/ system/ tests/ src/ Kernel/ Command/ StatusCommandTest.php, line 64
Class
- StatusCommandTest
- Tests the 'system:status' command.
Namespace
Drupal\Tests\system\Kernel\CommandCode
public function testWithUrl() : void {
// ApplicationTester does not setup argv for us. So we force it here.
$_SERVER['argv'] = [
'dr',
'system:status',
'--url',
'https://test.example.com',
];
$tester = $this->applicationTester();
$this->assertEquals(Command::SUCCESS, $tester->run([
'command' => 'system:status',
]));
$this->assertStringContainsStringNoWhitespace('Site URL : https://test.example.com', $tester->getDisplay());
// Try again with a subdirectory in the base URL.
$_SERVER['argv'] = [
'dr',
'example:command',
'--url',
'https://test.example.com/drupal',
];
$tester = $this->applicationTester();
$this->assertEquals(Command::SUCCESS, $tester->run([
'command' => 'system:status',
]));
$this->assertStringContainsStringNoWhitespace('Site URL : https://test.example.com/drupal', $tester->getDisplay());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.