StreamWrapperExampleTest.php in Examples for Developers 8
File
stream_wrapper_example/tests/src/Functional/StreamWrapperExampleTest.php
View source
<?php
namespace Drupal\Tests\stream_wrapper_example\Functional;
use Drupal\Tests\examples\Functional\ExamplesBrowserTestBase;
use Drupal\Core\Url;
class StreamWrapperExampleTest extends ExamplesBrowserTestBase {
protected $defaultTheme = 'stark';
public static $modules = [
'stream_wrapper_example',
];
public function testRoutes() {
$assert = $this
->assertSession();
$this
->drupalLogin($this
->createUser([
'access content',
]));
$links = [
'' => Url::fromRoute('stream_wrapper_example.description'),
];
foreach ($links as $page => $path) {
$this
->drupalGet($page);
$assert
->linkByHrefExists($path
->getInternalPath());
}
foreach ($links as $path) {
$this
->drupalGet($path);
$assert
->statusCodeEquals(200);
}
}
}