- <?php
- * @file
- * Tests for the Basis core theme.
- */
-
- * Test the addition of supplemental CSS update selectors on the body class.
- */
- class BasisTestCase extends BackdropWebTestCase {
- protected $profile = 'standard';
-
-
- * {@inheritdoc}
- */
- protected function setUp() {
- theme_enable(array('basis'));
- config_set('system.core', 'theme_default', 'basis');
- parent::setUp();
- }
-
-
- * Tests that body classes are added correctly for CSS updates.
- */
- public function testCssUpdates() {
-
- $path = backdrop_get_path('theme', 'basis');
- include_once $path . '/template.php';
-
-
- config_set('system.core', 'cache', 0);
-
- $css_update_versions = basis_updated_css_versions();
- $latest_update_version = reset($css_update_versions);
-
-
-
-
-
- $config = config('basis.settings');
- $this->assertEqual($config->get('css_update'), 'install', 'Basis defaults to using the latest CSS updates at the time Backdrop core is installed.');
- $this->assertEqual($config->get('css_update_version'), $latest_update_version, 'The most recent CSS update is set as the default.');
-
- $this->backdropGet('<front>');
-
- $this->assertTrue(in_array('update-1-30', $this->getBodyClasses()), 'The current CSS update version exists as a body class.');
-
-
- $config->set('css_update', 'version');
- $config->set('css_update_version', '');
- $config->save();
-
- $this->backdropGet('<front>');
- $body_class_string = implode(' ', $this->getBodyClasses());
- $this->assertFalse(strpos($body_class_string, 'update'), 'No CSS update classes exist on the body class.');
-
-
- $config->set('css_update', 'all');
- $config->set('css_update_version', '');
- $config->save();
-
- $this->backdropGet('<front>');
-
- $this->assertTrue(in_array('update-1-30', $this->getBodyClasses()), 'All CSS update versions exists within the body class.');
-
-
- $config->set('css_update', 'version');
- $config->set('css_update_version', '1.30');
- $config->save();
-
- $this->backdropGet('<front>');
-
- $this->assertTrue(in_array('update-1-30', $this->getBodyClasses()), 'The specific CSS update version exists as a body class.');
- }
-
-
- * Get all body classes on the current page as an array.
- *
- * @return string[]
- */
- private function getBodyClasses() {
- $body = current($this->xpath('//body'));
- return explode(' ', (string) $body->attributes()->class);
- }
- }