Same name in this branch
- 6.0.x advagg_bundler/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_bundler\Kernel\Form\SettingsFormTest
- 6.0.x advagg_css_minify/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_css_minify\Kernel\Form\SettingsFormTest
- 6.0.x advagg_js_minify/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_js_minify\Kernel\Form\SettingsFormTest
- 6.0.x advagg_ext_minify/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_ext_minify\Kernel\Form\SettingsFormTest
- 6.0.x advagg_mod/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_mod\Kernel\Form\SettingsFormTest
Same name in other branches
- 5.0.x advagg_old_ie_compatibility/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_old_ie_compatibility\Kernel\Form\SettingsFormTest
- 5.0.x advagg_bundler/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_bundler\Kernel\Form\SettingsFormTest
- 5.0.x advagg_css_minify/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_css_minify\Kernel\Form\SettingsFormTest
- 5.0.x advagg_js_minify/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_js_minify\Kernel\Form\SettingsFormTest
- 5.0.x advagg_cdn/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_cdn\Kernel\Form\SettingsFormTest
- 5.0.x tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg\Kernel\Form\SettingsFormTest
- 5.0.x advagg_ext_minify/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_ext_minify\Kernel\Form\SettingsFormTest
- 5.0.x advagg_mod/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_mod\Kernel\Form\SettingsFormTest
- 8.x-4.x advagg_old_ie_compatibility/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_old_ie_compatibility\Kernel\Form\SettingsFormTest
- 8.x-4.x advagg_bundler/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_bundler\Kernel\Form\SettingsFormTest
- 8.x-4.x advagg_css_minify/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_css_minify\Kernel\Form\SettingsFormTest
- 8.x-4.x advagg_js_minify/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_js_minify\Kernel\Form\SettingsFormTest
- 8.x-4.x advagg_cdn/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_cdn\Kernel\Form\SettingsFormTest
- 8.x-4.x tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg\Kernel\Form\SettingsFormTest
- 8.x-4.x advagg_ext_minify/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_ext_minify\Kernel\Form\SettingsFormTest
- 8.x-4.x advagg_mod/tests/src/Kernel/Form/SettingsFormTest.php \Drupal\Tests\advagg_mod\Kernel\Form\SettingsFormTest
Class for test Drupal\advagg\Form\SettingsForm.
@group advagg
Hierarchy
- class \Drupal\Tests\advagg\Kernel\Form\SettingsFormTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of SettingsFormTest
Fichier
-
tests/
src/ Kernel/ Form/ SettingsFormTest.php, line 14
Namespace
Drupal\Tests\advagg\Kernel\FormView source
class SettingsFormTest extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'advagg',
];
/**
* The Advagg settingForm.
*
* @var \Drupal\advagg\Form\SettingsForm
*/
protected $settingsForm;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->settingsForm = SettingsForm::create($this->container);
}
/**
* Test the cache level options.
*/
public function testCacheLevelOption() {
$options = $this->settingsForm
->getCacheLevelOptions();
$this->assertIsArray($options);
$this->assertTrue(in_array('Development', $options));
$this->assertTrue(in_array('High', $options));
}
/**
* Test the method getShortTimes.
*/
public function testShortTimes() {
$shortTime = $this->settingsForm
->getShortTimes();
$this->assertIsArray($shortTime);
$this->assertTrue(in_array('15 minutes', $shortTime));
$this->assertTrue(in_array('2 days', $shortTime));
}
/**
* Test the method getLongTimes.
*/
public function testLongTimes() {
$longTimes = $this->settingsForm
->getLongTimes();
$this->assertIsArray($longTimes);
$this->assertTrue(in_array('2 days', $longTimes));
$this->assertTrue(in_array('2 months', $longTimes));
}
/**
* Tests for \Drupal\advagg\Form\SettingsForm.
*/
public function testSettingsForm() {
$this->assertInstanceOf(FormInterface::class, $this->settingsForm);
$id = $this->settingsForm
->getFormId();
$this->assertEquals('advagg_settings', $id);
$method = new \ReflectionMethod(SettingsForm::class, 'getEditableConfigNames');
$method->setAccessible(TRUE);
$name = $method->invoke($this->settingsForm);
$this->assertEquals([
'advagg.settings',
'system.performance',
], $name);
}
}
Members
Titre Trier par ordre décroissant | Modifiers | Object type | Résumé |
---|---|---|---|
SettingsFormTest::$modules | protected static | property | Modules to enable. |
SettingsFormTest::$settingsForm | protected | property | The Advagg settingForm. |
SettingsFormTest::setUp | protected | function | |
SettingsFormTest::testCacheLevelOption | public | function | Test the cache level options. |
SettingsFormTest::testLongTimes | public | function | Test the method getLongTimes. |
SettingsFormTest::testSettingsForm | public | function | Tests for \Drupal\advagg\Form\SettingsForm. |
SettingsFormTest::testShortTimes | public | function | Test the method getShortTimes. |