function ImageTest::providerTestGetKeywordOffset
Provides data for testGetKeywordOffset().
Return value
\Generator Test scenarios.
See also
testGetKeywordOffset()
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ ImageTest.php, line 188
Class
Namespace
Drupal\Tests\Component\UtilityCode
public static function providerTestGetKeywordOffset() : \Generator {
yield "'left' => return 0" => [
'input' => [
'anchor' => 'left',
'current' => 100,
'new' => 20,
],
'expected' => 0,
];
yield "'top' => return 0" => [
'input' => [
'anchor' => 'top',
'current' => 100,
'new' => 20,
],
'expected' => 0,
];
yield "'right' => return (current - new)" => [
'input' => [
'anchor' => 'right',
'current' => 100,
'new' => 20,
],
'expected' => 80,
];
yield "'bottom' => return (current - new)" => [
'input' => [
'anchor' => 'bottom',
'current' => 100,
'new' => 30,
],
'expected' => 70,
];
yield "a) 'center' => return (current - new)/2" => [
'input' => [
'anchor' => 'center',
'current' => 100,
'new' => 20,
],
'expected' => 40,
];
yield "b) 'center' => return (current - new)/2" => [
'input' => [
'anchor' => 'center',
'current' => 100,
'new' => 91,
],
'expected' => 5,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.