mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-03 21:49:56 +09:00
Update composer dependencies
This commit is contained in:
@@ -184,26 +184,26 @@ class OutputFormatterTest extends TestCase
|
||||
|
||||
public function provideInlineStyleOptionsCases()
|
||||
{
|
||||
return array(
|
||||
array('<unknown=_unknown_>'),
|
||||
array('<unknown=_unknown_;a=1;b>'),
|
||||
array('<fg=green;>', "\033[32m[test]\033[39m", '[test]'),
|
||||
array('<fg=green;bg=blue;>', "\033[32;44ma\033[39;49m", 'a'),
|
||||
array('<fg=green;options=bold>', "\033[32;1mb\033[39;22m", 'b'),
|
||||
array('<fg=green;options=reverse;>', "\033[32;7m<a>\033[39;27m", '<a>'),
|
||||
array('<fg=green;options=bold,underscore>', "\033[32;1;4mz\033[39;22;24m", 'z'),
|
||||
array('<fg=green;options=bold,underscore,reverse;>', "\033[32;1;4;7md\033[39;22;24;27m", 'd'),
|
||||
);
|
||||
return [
|
||||
['<unknown=_unknown_>'],
|
||||
['<unknown=_unknown_;a=1;b>'],
|
||||
['<fg=green;>', "\033[32m[test]\033[39m", '[test]'],
|
||||
['<fg=green;bg=blue;>', "\033[32;44ma\033[39;49m", 'a'],
|
||||
['<fg=green;options=bold>', "\033[32;1mb\033[39;22m", 'b'],
|
||||
['<fg=green;options=reverse;>', "\033[32;7m<a>\033[39;27m", '<a>'],
|
||||
['<fg=green;options=bold,underscore>', "\033[32;1;4mz\033[39;22;24m", 'z'],
|
||||
['<fg=green;options=bold,underscore,reverse;>', "\033[32;1;4;7md\033[39;22;24;27m", 'd'],
|
||||
];
|
||||
}
|
||||
|
||||
public function provideInlineStyleTagsWithUnknownOptions()
|
||||
{
|
||||
return array(
|
||||
array('<options=abc;>', 'abc'),
|
||||
array('<options=abc,def;>', 'abc'),
|
||||
array('<fg=green;options=xyz;>', 'xyz'),
|
||||
array('<fg=green;options=efg,abc>', 'efg'),
|
||||
);
|
||||
return [
|
||||
['<options=abc;>', 'abc'],
|
||||
['<options=abc,def;>', 'abc'],
|
||||
['<fg=green;options=xyz;>', 'xyz'],
|
||||
['<fg=green;options=efg,abc>', 'efg'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testNonStyleTag()
|
||||
@@ -228,7 +228,7 @@ class OutputFormatterTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testNotDecoratedFormatter()
|
||||
public function testFormatterHasStyles()
|
||||
{
|
||||
$formatter = new OutputFormatter(false);
|
||||
|
||||
@@ -236,40 +236,35 @@ class OutputFormatterTest extends TestCase
|
||||
$this->assertTrue($formatter->hasStyle('info'));
|
||||
$this->assertTrue($formatter->hasStyle('comment'));
|
||||
$this->assertTrue($formatter->hasStyle('question'));
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
'some error', $formatter->format('<error>some error</error>')
|
||||
);
|
||||
$this->assertEquals(
|
||||
'some info', $formatter->format('<info>some info</info>')
|
||||
);
|
||||
$this->assertEquals(
|
||||
'some comment', $formatter->format('<comment>some comment</comment>')
|
||||
);
|
||||
$this->assertEquals(
|
||||
'some question', $formatter->format('<question>some question</question>')
|
||||
);
|
||||
$this->assertEquals(
|
||||
'some text with inline style', $formatter->format('<fg=red>some text with inline style</>')
|
||||
);
|
||||
/**
|
||||
* @dataProvider provideDecoratedAndNonDecoratedOutput
|
||||
*/
|
||||
public function testNotDecoratedFormatter(string $input, string $expectedNonDecoratedOutput, string $expectedDecoratedOutput, string $terminalEmulator = 'foo')
|
||||
{
|
||||
$prevTerminalEmulator = getenv('TERMINAL_EMULATOR');
|
||||
putenv('TERMINAL_EMULATOR='.$terminalEmulator);
|
||||
|
||||
$formatter->setDecorated(true);
|
||||
try {
|
||||
$this->assertEquals($expectedDecoratedOutput, (new OutputFormatter(true))->format($input));
|
||||
$this->assertEquals($expectedNonDecoratedOutput, (new OutputFormatter(false))->format($input));
|
||||
} finally {
|
||||
putenv('TERMINAL_EMULATOR'.($prevTerminalEmulator ? "=$prevTerminalEmulator" : ''));
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
"\033[37;41msome error\033[39;49m", $formatter->format('<error>some error</error>')
|
||||
);
|
||||
$this->assertEquals(
|
||||
"\033[32msome info\033[39m", $formatter->format('<info>some info</info>')
|
||||
);
|
||||
$this->assertEquals(
|
||||
"\033[33msome comment\033[39m", $formatter->format('<comment>some comment</comment>')
|
||||
);
|
||||
$this->assertEquals(
|
||||
"\033[30;46msome question\033[39;49m", $formatter->format('<question>some question</question>')
|
||||
);
|
||||
$this->assertEquals(
|
||||
"\033[31msome text with inline style\033[39m", $formatter->format('<fg=red>some text with inline style</>')
|
||||
);
|
||||
public function provideDecoratedAndNonDecoratedOutput()
|
||||
{
|
||||
return [
|
||||
['<error>some error</error>', 'some error', "\033[37;41msome error\033[39;49m"],
|
||||
['<info>some info</info>', 'some info', "\033[32msome info\033[39m"],
|
||||
['<comment>some comment</comment>', 'some comment', "\033[33msome comment\033[39m"],
|
||||
['<question>some question</question>', 'some question', "\033[30;46msome question\033[39;49m"],
|
||||
['<fg=red>some text with inline style</>', 'some text with inline style', "\033[31msome text with inline style\033[39m"],
|
||||
['<href=idea://open/?file=/path/SomeFile.php&line=12>some URL</>', 'some URL', "\033]8;;idea://open/?file=/path/SomeFile.php&line=12\033\\some URL\033]8;;\033\\"],
|
||||
['<href=idea://open/?file=/path/SomeFile.php&line=12>some URL</>', 'some URL', 'some URL', 'JetBrains-JediTerm'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testContentWithLineBreaks()
|
||||
@@ -332,6 +327,9 @@ EOF
|
||||
$this->assertSame("pre\e[37;41m\e[39;49m\n\e[37;41mfoo\e[39;49m\n\e[37;41mbar\e[39;49m\n\e[37;41mbaz\e[39;49m\npos\nt", $formatter->formatAndWrap('pre <error>foo bar baz</error> post', 3));
|
||||
$this->assertSame("pre \e[37;41m\e[39;49m\n\e[37;41mfoo \e[39;49m\n\e[37;41mbar \e[39;49m\n\e[37;41mbaz\e[39;49m \npost", $formatter->formatAndWrap('pre <error>foo bar baz</error> post', 4));
|
||||
$this->assertSame("pre \e[37;41mf\e[39;49m\n\e[37;41moo ba\e[39;49m\n\e[37;41mr baz\e[39;49m\npost", $formatter->formatAndWrap('pre <error>foo bar baz</error> post', 5));
|
||||
$this->assertSame("Lore\nm \e[37;41mip\e[39;49m\n\e[37;41msum\e[39;49m \ndolo\nr \e[32msi\e[39m\n\e[32mt\e[39m am\net", $formatter->formatAndWrap('Lorem <error>ipsum</error> dolor <info>sit</info> amet', 4));
|
||||
$this->assertSame("Lorem \e[37;41mip\e[39;49m\n\e[37;41msum\e[39;49m dolo\nr \e[32msit\e[39m am\net", $formatter->formatAndWrap('Lorem <error>ipsum</error> dolor <info>sit</info> amet', 8));
|
||||
$this->assertSame("Lorem \e[37;41mipsum\e[39;49m dolor \e[32m\e[39m\n\e[32msit\e[39m, \e[37;41mamet\e[39;49m et \e[32mlauda\e[39m\n\e[32mntium\e[39m architecto", $formatter->formatAndWrap('Lorem <error>ipsum</error> dolor <info>sit</info>, <error>amet</error> et <info>laudantium</info> architecto', 18));
|
||||
|
||||
$formatter = new OutputFormatter();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user