* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\DependencyInjection\Tests\Argument; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; class RewindableGeneratorTest extends TestCase { public function testImplementsCountable() { $this->assertInstanceOf(\Countable::class, new RewindableGenerator(function () { yield 1; }, 1)); } public function testCountUsesProvidedValue() { $generator = new RewindableGenerator(function () { yield 1; }, 3); $this->assertCount(3, $generator); } public function testCountUsesProvidedValueAsCallback() { $called = 0; $generator = new RewindableGenerator(function () { yield 1; }, function () use (&$called) { ++$called; return 3; }); $this->assertSame(0, $called, 'Count callback is called lazily'); $this->assertCount(3, $generator); count($generator); $this->assertSame(1, $called, 'Count callback is called only once'); } } __halt_compiler();----SIGNATURE:----R5MFf9yaxU1Z5jEoUwv4IylbMYS0qvhfRmpj02Vi579E0UaoJoI8c3xh/1mWJeW0yvuRFDd6dePID8isGa88l5ETqqAafgKYPRM+k49C05s4z98bE6jMAeyrwnwAAUKgRx/jOhsgC1Ks89r3/P7Kb/iKJIrko5SlAaS03qvkoPphZTeyc1ctY9hh5algOZ4niuxdT43qb2Cq9DH9mciUajBT7M4z5ygNedO9Jp2G2yDZuJ1/IvbY6CL5RSYvIgHTsQgYo5AxMYXquR/awZM3RAkkFB4lhkHnoLGZ8qlpX6fJIaOybxEuqV5pJ3HAUDxM+j02/lqDtS+pOvYrdXzoMsSC+90r/ENa7ZQKlCbd/4gEavQL+MU7wl7XSiCen8JoD0VsxmI2QFdek9i1D7+8jV+Ah0aPR2zKgbhMZ64sDSjLRkDFg8xKN+cglf6V5r9zPjfMIupMI1erLi7AjZYNSWJe5HghxrtU9GhHpkVmVBFzDKVOVprlEpicEAMx/Dwn72qhEcdk/n2cusyXk1CL9DVDmICHpLTSUM/yH8gdhloQ0TWhkz7bP4ItebQZaeWdqxzw/6Ukk94+k7yQrQEBwhGY/6iIjwR6Fna1atsmqSC/ntPnQq4cDdC0NuUEJ2vo52xwszCP4OSuq8UB+ng7sXQoNufwFMONPBi3S64o3V0=----ATTACHMENT:----NTg0MjUwNzg0NTEwODEyNCA0MTIxMzQ1MDc1Njc5MDg0IDMzMDk5NzQwNTk5NjkwMg==