class BasisTestCase extends BackdropWebTestCase {
protected $profile = 'standard';
protected function setUp() {
theme_enable(array('basis'));
config_set('system.core', 'theme_default', 'basis');
parent::setUp();
}
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.');
}
private function getBodyClasses() {
$body = current($this->xpath('//body'));
return explode(' ', (string) $body->attributes()->class);
}
}