BasicUsageTest.php in Lightning API 8.4
File
tests/src/Functional/BasicUsageTest.php
View source
<?php
namespace Drupal\Tests\lightning_api\Functional;
use Drupal\Tests\BrowserTestBase;
class BasicUsageTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'lightning_api',
];
protected function setUp() {
parent::setUp();
$this
->config('lightning_api.settings')
->set('entity_json', TRUE)
->set('bundle_docs', TRUE)
->save();
$this
->drupalCreateContentType([
'type' => 'test',
]);
$this
->drupalCreateNode([
'type' => 'test',
]);
$this->container
->get('entity_type.bundle.info')
->clearCachedBundles();
}
public function testBasicUsage() {
$assert_session = $this
->assertSession();
$page = $this
->getSession()
->getPage();
$account = $this
->drupalCreateUser([], NULL, TRUE);
$this
->drupalLogin($account);
$this
->drupalGet('/admin/content');
$page
->clickLink('View JSON');
$assert_session
->statusCodeEquals(200);
$this
->drupalGet('/admin/structure/types');
$this
->clickLink('View JSON');
$assert_session
->statusCodeEquals(200);
$this
->drupalGet('/api-docs');
$assert_session
->statusCodeEquals(200);
$this
->drupalGet('/admin/structure/types');
$this
->clickLink('View API documentation');
$assert_session
->statusCodeEquals(200);
}
}
Classes
Name |
Description |
BasicUsageTest |
Tests very basic administrator-facing functionality of Lightning API. |