mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
23080c443e
commit
70926fbb7f
4 changed files with 21 additions and 17 deletions
|
@ -159,7 +159,7 @@ class ConsoleInputArgument {
|
|||
$option = $parent->addChild('argument');
|
||||
$option->addAttribute('name', $this->_name);
|
||||
$option->addAttribute('help', $this->_help);
|
||||
$option->addAttribute('required', $this->isRequired());
|
||||
$option->addAttribute('required', (int)$this->isRequired());
|
||||
$choices = $option->addChild('choices');
|
||||
foreach ($this->_choices as $valid) {
|
||||
$choices->addChild('choice', $valid);
|
||||
|
|
|
@ -205,10 +205,11 @@ class ConsoleInputOption {
|
|||
$option->addAttribute('name', '--' . $this->_name);
|
||||
$short = '';
|
||||
if (strlen($this->_short)) {
|
||||
$short = $this->_short;
|
||||
$short = '-' . $this->_short;
|
||||
}
|
||||
$option->addAttribute('short', '-' . $short);
|
||||
$option->addAttribute('boolean', $this->_boolean);
|
||||
$option->addAttribute('short', $short);
|
||||
$option->addAttribute('help', $this->_help);
|
||||
$option->addAttribute('boolean', (int)$this->_boolean);
|
||||
$option->addChild('default', $this->_default);
|
||||
$choices = $option->addChild('choices');
|
||||
foreach ($this->_choices as $valid) {
|
||||
|
|
|
@ -182,7 +182,6 @@ class HelpFormatter {
|
|||
$xml->addChild('command', $parser->command());
|
||||
$xml->addChild('description', $parser->description());
|
||||
|
||||
$xml->addChild('epilog', $parser->epilog());
|
||||
$subcommands = $xml->addChild('subcommands');
|
||||
foreach ($parser->subcommands() as $command) {
|
||||
$command->xml($subcommands);
|
||||
|
@ -195,6 +194,7 @@ class HelpFormatter {
|
|||
foreach ($parser->arguments() as $argument) {
|
||||
$argument->xml($arguments);
|
||||
}
|
||||
$xml->addChild('epilog', $parser->epilog());
|
||||
return $string ? $xml->asXml() : $xml;
|
||||
}
|
||||
|
||||
|
|
|
@ -299,8 +299,8 @@ TEXT;
|
|||
$expected = <<<TEXT
|
||||
<?xml version="1.0"?>
|
||||
<shell>
|
||||
<name>mycommand</name>
|
||||
<description>Description text</description>
|
||||
<command>mycommand</command>
|
||||
<description />
|
||||
<subcommands />
|
||||
<options>
|
||||
<option name="--help" short="-h" help="Display this help." boolean="1">
|
||||
|
@ -322,11 +322,14 @@ TEXT;
|
|||
<choice>aro</choice>
|
||||
</choices>
|
||||
</argument>
|
||||
<argument help="Another argument." name="other_longer" required="0">
|
||||
<choices/>
|
||||
</argument>
|
||||
</arguments>
|
||||
<epilog>epilog text</epilog>
|
||||
<epilog />
|
||||
</shell>
|
||||
TEXT;
|
||||
$this->assertEquals(new DomDocument($expected), new DomDocument($result), 'Help does not match');
|
||||
$this->assertXmlStringEqualsXmlString($expected, $result, 'Help does not match');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -346,7 +349,7 @@ TEXT;
|
|||
$expected = <<<TEXT
|
||||
<?xml version="1.0"?>
|
||||
<shell>
|
||||
<name>mycommand</name>
|
||||
<command>mycommand</command>
|
||||
<description>Description text</description>
|
||||
<subcommands />
|
||||
<options>
|
||||
|
@ -367,7 +370,7 @@ TEXT;
|
|||
<epilog>epilog text</epilog>
|
||||
</shell>
|
||||
TEXT;
|
||||
$this->assertEquals(new DomDocument($expected), new DomDocument($result), 'Help does not match');
|
||||
$this->assertXmlStringEqualsXmlString($expected, $result, 'Help does not match');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -385,7 +388,7 @@ TEXT;
|
|||
$expected = <<<TEXT
|
||||
<?xml version="1.0"?>
|
||||
<shell>
|
||||
<name>mycommand</name>
|
||||
<command>mycommand</command>
|
||||
<description/>
|
||||
<subcommands>
|
||||
<command name="method" help="This is another command" />
|
||||
|
@ -404,7 +407,7 @@ TEXT;
|
|||
<epilog/>
|
||||
</shell>
|
||||
TEXT;
|
||||
$this->assertEquals(new DomDocument($expected), new DomDocument($result), 'Help does not match');
|
||||
$this->assertXmlStringEqualsXmlString($expected, $result, 'Help does not match');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -424,7 +427,7 @@ TEXT;
|
|||
$expected = <<<TEXT
|
||||
<?xml version="1.0"?>
|
||||
<shell>
|
||||
<name>mycommand</name>
|
||||
<command>mycommand</command>
|
||||
<description/>
|
||||
<subcommands/>
|
||||
<options>
|
||||
|
@ -445,7 +448,7 @@ TEXT;
|
|||
<epilog/>
|
||||
</shell>
|
||||
TEXT;
|
||||
$this->assertEquals(new DomDocument($expected), new DomDocument($result), 'Help does not match');
|
||||
$this->assertXmlStringEqualsXmlString($expected, $result, 'Help does not match');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -464,7 +467,7 @@ TEXT;
|
|||
$expected = <<<TEXT
|
||||
<?xml version="1.0"?>
|
||||
<shell>
|
||||
<name>mycommand</name>
|
||||
<command>mycommand</command>
|
||||
<description/>
|
||||
<subcommands/>
|
||||
<options>
|
||||
|
@ -488,7 +491,7 @@ TEXT;
|
|||
<epilog/>
|
||||
</shell>
|
||||
TEXT;
|
||||
$this->assertEquals(new DomDocument($expected), new DomDocument($result), 'Help does not match');
|
||||
$this->assertXmlStringEqualsXmlString($expected, $result, 'Help does not match');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue