use Symfony\Component\Form\Tests\Fixtures\ArrayChoiceLoader;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class LazyChoiceListTest extends TestCase
{ public function testGetChoiceLoadersLoadsLoadedListOnFirstCall() { $choices =
['RESULT'
];
$calls = 0;
$list =
new LazyChoiceList(new ArrayChoiceLoader($choices),
function D
$choice) use ($choices, &
$calls) { ++
$calls;
return array_search($choice,
$choices);
});
$this->
assertSame(['RESULT'
],
$list->
getChoices());
$this->
assertSame(['RESULT'
],
$list->
getChoices());
$this->
assertSame(2,
$calls);
} public function testGetValuesLoadsLoadedListOnFirstCall() {