function ToolkitTest::testApply
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php \Drupal\KernelTests\Core\Image\ToolkitTest::testApply()
- 8.9.x core/tests/Drupal/FunctionalTests/Image/ToolkitTest.php \Drupal\FunctionalTests\Image\ToolkitTest::testApply()
- 11.x core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php \Drupal\KernelTests\Core\Image\ToolkitTest::testApply()
Tests the 'apply' method.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Image/ ToolkitTest.php, line 87
Class
- ToolkitTest
- Tests the image toolkit.
Namespace
Drupal\KernelTests\Core\ImageCode
public function testApply() : void {
$data = [
'p1' => 1,
'p2' => TRUE,
'p3' => 'text',
];
// The operation plugin itself does not exist, so apply will return false.
$this->assertFalse($this->image
->apply('my_operation', $data));
// Check that apply was called and with the correct parameters.
$this->assertToolkitOperationsCalled([
'apply',
]);
$calls = $this->imageTestGetAllCalls();
$this->assertEquals('my_operation', $calls['apply'][0][0]);
$this->assertEquals(1, $calls['apply'][0][1]['p1']);
$this->assertTrue($calls['apply'][0][1]['p2']);
$this->assertEquals('text', $calls['apply'][0][1]['p3']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.