createClosure example

return [
            [true, 'not bound to the command'],
            [false, 'bound to the command'],
        ];
    }

    /** * @dataProvider getSetCodeBindToClosureTests */
    public function testSetCodeBindToClosure($previouslyBound$expected)
    {
        $code = createClosure();
        if ($previouslyBound) {
            $code = $code->bindTo($this);
        }

        $command = new \TestCommand();
        $command->setCode($code);
        $tester = new CommandTester($command);
        $tester->execute([]);
        $this->assertEquals('interact called'.\PHP_EOL.$expected.\PHP_EOL, $tester->getDisplay());
    }

    
Home | Imprint | This part of the site doesn't use cookies.