diff --git a/src/Tests/ApiKeyConfigurationTest.php b/src/Tests/ApiKeyConfigurationTest.php index 1e414e6..608f11c 100755 --- a/src/Tests/ApiKeyConfigurationTest.php +++ b/src/Tests/ApiKeyConfigurationTest.php @@ -21,6 +21,15 @@ class ApiKeyConfigurationTest extends WebTestBase { public static $modules = ['google_vision']; /** + * Disable strict config schema checking. + * + * The schema is verified at the end of running the update. + * + * @var bool + */ + protected $strictConfigSchema = FALSE; + + /** * A user with permission to create and edit books and to administer blocks. * * @var object @@ -53,4 +62,21 @@ class ApiKeyConfigurationTest extends WebTestBase { $this->assertLinkByHref(Url::fromRoute('google_vision.settings')->toString()); } + + /** + * Test to verify that it is stored successfully. + */ + function testKeyStorage() { + $this->drupalGet(Url::fromRoute('google_vision.settings')); + $this->assertResponse(200); + $this->assertFieldByName('api_key', '', 'The key is not set currently'); + $apiKey = $this->randomString(40); + $data = array( + 'api_key' => $apiKey, + ); + $this->drupalPostForm(Url::fromRoute('google_vision.settings'), $data, t('Save configuration')); + $this->drupalGet(Url::fromRoute('google_vision.settings')); + $this->assertResponse(200); + $this->assertFieldByName('api_key', $apiKey, 'The key has been saved'); + } }