Same name in other branches
- 5.0.x tests/src/Functional/AdvaggPathManipulationTest.php \Drupal\Tests\advagg\Functional\AdvaggPathManipulationTest
- 6.0.x tests/src/Functional/AdvaggPathManipulationTest.php \Drupal\Tests\advagg\Functional\AdvaggPathManipulationTest
- 8.x-2.x src/Tests/AdvaggPathManipulationTest.php \Drupal\advagg\Tests\AdvaggPathManipulationTest
- 8.x-3.x tests/src/Functional/AdvaggPathManipulationTest.php \Drupal\Tests\advagg\Functional\AdvaggPathManipulationTest
Tests that all the asset path settings function correctly.
@group advagg
Hierarchy
- class \Drupal\Tests\advagg\functional\AdvaggFunctionalTestBase extends \Drupal\Tests\BrowserTestBase uses \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\Tests\advagg\Functional\AdvaggPathManipulationTest extends \Drupal\Tests\advagg\Functional\AdvaggFunctionalTestBase
Expanded class hierarchy of AdvaggPathManipulationTest
Related topics
File
-
tests/
src/ Functional/ AdvaggPathManipulationTest.php, line 14
Namespace
Drupal\Tests\advagg\FunctionalView source
class AdvaggPathManipulationTest extends AdvaggFunctionalTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'advagg',
'advagg_test',
];
/**
* Tests path converting functions, and that saving a change to them works.
*/
public function testPathFunctions() {
global $base_path;
// Test convert absolute to protocol relative paths.
$this->drupalGet(Url::fromRoute('advagg.settings'));
$session = $this->assertSession();
$session->responseContains('src="//cdn.jsdelivr.net/jquery.actual/1.0.18/jquery.actual.min.js');
$session->responseContains('src="' . $base_path . 'core/assets/vendor/modernizr/modernizr.min.js');
// Test convert force HTTPS.
$edit = [];
$edit['path_convert_absolute_to_protocol_relative'] = FALSE;
$edit['path_convert_force_https'] = TRUE;
$edit['path_convert_absolute'] = FALSE;
$this->submitForm($edit, 'op');
$config = $this->config('advagg.settings');
$this->assertTrue($config->get('path.convert.force_https'));
$session = $this->assertSession();
$session->responseContains('src="https://cdn.jsdelivr.net/jquery.actual/1.0.18/jquery.actual.min.js');
$session->responseContains('src="' . $base_path . 'core/assets/vendor/modernizr/modernizr.min.js');
// Test convert force absolute path.
$edit = [];
$edit['path_convert_absolute_to_protocol_relative'] = FALSE;
$edit['path_convert_force_https'] = FALSE;
$edit['path_convert_absolute'] = TRUE;
$this->submitForm($edit, 'op');
global $base_root;
$config = $this->config('advagg.settings');
$this->assertTrue($config->get('path.convert.absolute'));
$session = $this->assertSession();
$session->responseContains('src="http://cdn.jsdelivr.net/jquery.actual/1.0.18/jquery.actual.min.js');
$session->responseContains('src="' . $base_root . $base_path . 'core/assets/vendor/modernizr/modernizr.min.js');
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AdvaggFunctionalTestBase::$defaultTheme | protected | property | ||
AdvaggFunctionalTestBase::$user | protected | property | A user with permission to administer site configuration. | |
AdvaggFunctionalTestBase::setUp | protected | function | ||
AdvaggPathManipulationTest::$modules | protected static | property | Modules to enable. | Overrides AdvaggFunctionalTestBase::$modules |
AdvaggPathManipulationTest::testPathFunctions | public | function | Tests path converting functions, and that saving a change to them works. |