public function EntityPrintTest::testEntityPrintThemeCss in Entity Print 8
Test that CSS is parsed from our test theme correctly.
File
- src/
Tests/ EntityPrintTest.php, line 58
Class
- EntityPrintTest
- Entity Print tests.
Namespace
Drupal\entity_print\TestsCode
public function testEntityPrintThemeCss() {
// Create a user and login.
$account = $this
->drupalCreateUser([
'bypass entity print access',
'access content',
], $this
->randomMachineName());
$this
->drupalLogin($account);
$this
->drupalGet('entityprint/node/' . $this->node
->id() . '/debug');
$config = \Drupal::configFactory()
->getEditable('entity_print.settings');
// Test the global CSS is there.
$this
->assertRaw('entity-print.css');
// Disable the global CSS and test it is not there.
$config
->set('default_css', FALSE)
->save();
$this
->drupalGet($this
->getUrl());
$this
->assertNoRaw('entity-print.css');
// Assert that the css files have been parsed out of our test theme.
$this
->assertRaw('entityprint-all.css');
$this
->assertRaw('entityprint-page.css');
$this
->assertRaw('entityprint-node.css');
// Test that CSS was added from hook_entity_print_css(). See the
// entity_print_test module for the implementation.
$this
->assertRaw('entityprint-module.css');
}