function QuickEditImageControllerTest::testFieldInfo
Same name in other branches
- 8.9.x core/modules/image/tests/src/Functional/QuickEditImageControllerTest.php \Drupal\Tests\image\Functional\QuickEditImageControllerTest::testFieldInfo()
Tests that the field info route returns expected data.
File
-
core/
modules/ quickedit/ tests/ src/ Functional/ QuickEditImageControllerTest.php, line 101
Class
- QuickEditImageControllerTest
- Tests the endpoints used by the "image" in-place editor.
Namespace
Drupal\Tests\quickedit\FunctionalCode
public function testFieldInfo() {
// Create a test Node.
$node = $this->drupalCreateNode([
'type' => 'article',
'title' => 'Test Node',
]);
$json = $this->drupalGet('quickedit/image/info/node/' . $node->id() . '/' . $this->fieldName . '/' . $node->language()
->getId() . '/default', [
'query' => [
'_format' => 'json',
],
]);
$info = Json::decode($json);
// Assert that the default settings for our field are respected by our JSON
// endpoint.
$this->assertTrue($info['alt_field']);
$this->assertFalse($info['title_field']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.