Namespace
Drupal\Tests\advagg\Kernel\Form
Fichier
-
tests/src/Kernel/Form/SettingsFormTest.php
View source
<?php
namespace Drupal\Tests\advagg\Kernel\Form;
use Drupal\advagg\Form\SettingsForm;
use Drupal\Core\Form\FormInterface;
use Drupal\KernelTests\KernelTestBase;
class SettingsFormTest extends KernelTestBase {
protected static $modules = [
'advagg',
];
protected $settingsForm;
protected function setUp() : void {
parent::setUp();
$this->settingsForm = SettingsForm::create($this->container);
}
public function testCacheLevelOption() {
$options = $this->settingsForm
->getCacheLevelOptions();
$this->assertIsArray($options);
$this->assertTrue(in_array('Development', $options));
$this->assertTrue(in_array('High', $options));
}
public function testShortTimes() {
$shortTime = $this->settingsForm
->getShortTimes();
$this->assertIsArray($shortTime);
$this->assertTrue(in_array('15 minutes', $shortTime));
$this->assertTrue(in_array('2 days', $shortTime));
}
public function testLongTimes() {
$longTimes = $this->settingsForm
->getLongTimes();
$this->assertIsArray($longTimes);
$this->assertTrue(in_array('2 days', $longTimes));
$this->assertTrue(in_array('2 months', $longTimes));
}
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);
}
}
Classes
| Titre |
Deprecated |
Résumé |
| SettingsFormTest |
|
Class for test Drupal\advagg\Form\SettingsForm. |