<?php
namespace Kahlan\Spec\Suite\Cli;
use Kahlan\Cli\CommandLine;
describe("CommandLine", function () {
describe("->option", function () {
it("sets an option config", function () {
$commandLine = new CommandLine();
$commandLine->option('option1', ['type' => 'boolean']);
expect($commandLine->option('option1'))->toEqual(['type' => 'boolean', 'group' => false, 'array' => false, 'value' => null, 'default' => null]);
$options = $commandLine->options();
expect($options)->toBeAn('array');
expect(isset($options['option1']))->toBe(true);
expect($options['option1'])->toEqual(['type' => 'boolean', 'group' => false, 'array' => false, 'value' => null, 'default' => null]);
});
it("gets the default config", function () {
$commandLine = new CommandLine();
expect($commandLine->option('option1'))->toEqual(['type' => 'string', 'group' => false, 'array' => false, 'value' => null, 'default' => null]);
});
it("sets/updates an attribute of an option", function () {
$commandLine = new CommandLine();
$commandLine->option('option1', ['type' => 'boolean']);
expect($commandLine->option('option1'))->toEqual(['type' => 'boolean', 'group' => false, 'array' => false, 'value' => null, 'default' => null]);
$commandLine->option('option1', 'default', 'value1');
expect($commandLine->option('option1'))->toEqual(['type' => 'boolean', 'group' => false, 'array' => false, 'value' => null, 'default' => 'value1']);
});
});
describe("->parse()", function () {
it("parses command line options", function () {
$commandLine = new CommandLine();