class ClosureTest in Coder 8.3
Same name and namespace in other branches
- 8.2 coder_sniffer/DrupalPractice/Test/good/good.php \ClosureTest
- 8.3.x tests/DrupalPractice/good/good.php \ClosureTest
Testing closures.
Hierarchy
- class \ClosureTest extends \TestCase
Expanded class hierarchy of ClosureTest
File
- tests/
DrupalPractice/ good/ good.php, line 129
View source
class ClosureTest extends TestCase {
/**
* Use $this in a closure, which should be a defined variable.
*/
public function getEntities($limit) {
// Create an array of dummy entities.
$entities = array_map(function () {
return $this
->prophesize(EntityInterface::class)
->reveal();
}, range(1, $limit));
return $entities;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ClosureTest:: |
public | function | Use $this in a closure, which should be a defined variable. |