Commando\Test\CommandTest::testBooleanOption PHP Method

testBooleanOption() public method

public testBooleanOption ( )
    public function testBooleanOption()
    {
        // with bool flag
        $tokens = array('filename', 'arg1', '-b', 'arg2');
        $cmd = new Command($tokens);
        $cmd->option('b')->boolean();
        $this->assertTrue($cmd['b']);
        // without
        $tokens = array('filename', 'arg1', 'arg2');
        $cmd = new Command($tokens);
        $cmd->option('b')->boolean();
        $this->assertFalse($cmd['b']);
        // try inverse bool default operations...
        // with bool flag
        $tokens = array('filename', 'arg1', '-b', 'arg2');
        $cmd = new Command($tokens);
        $cmd->option('b')->default(true)->boolean();
        $this->assertFalse($cmd['b']);
        // without
        $tokens = array('filename', 'arg1', 'arg2');
        $cmd = new Command($tokens);
        $cmd->option('b')->default(true)->boolean();
        $this->assertTrue($cmd['b']);
    }