platform/api/symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.yaml

84 lines
4.9 KiB
YAML
Raw Normal View History

2024-09-02 17:44:11 +00:00
name: ProgressIndicatorTest
class_comment: '# * @group time-sensitive'
dependencies:
- name: TestCase
type: class
source: PHPUnit\Framework\TestCase
- name: ProgressIndicator
type: class
source: Symfony\Component\Console\Helper\ProgressIndicator
- name: StreamOutput
type: class
source: Symfony\Component\Console\Output\StreamOutput
properties: []
methods:
- name: testFormats
visibility: public
parameters:
- name: format
comment: "# * @group time-sensitive\n# */\n# class ProgressIndicatorTest extends\
\ TestCase\n# {\n# public function testDefaultIndicator()\n# {\n# $bar = new ProgressIndicator($output\
\ = $this->getOutputStream());\n# $bar->start('Starting...');\n# usleep(101000);\n\
# $bar->advance();\n# usleep(101000);\n# $bar->advance();\n# usleep(101000);\n\
# $bar->advance();\n# usleep(101000);\n# $bar->advance();\n# usleep(101000);\n\
# $bar->advance();\n# usleep(101000);\n# $bar->setMessage('Advancing...');\n#\
\ $bar->advance();\n# $bar->finish('Done...');\n# $bar->start('Starting Again...');\n\
# usleep(101000);\n# $bar->advance();\n# $bar->finish('Done Again...');\n# \n\
# rewind($output->getStream());\n# \n# $this->assertEquals(\n# $this->generateOutput('\
\ - Starting...').\n# $this->generateOutput(' \\\\ Starting...').\n# $this->generateOutput('\
\ | Starting...').\n# $this->generateOutput(' / Starting...').\n# $this->generateOutput('\
\ - Starting...').\n# $this->generateOutput(' \\\\ Starting...').\n# $this->generateOutput('\
\ \\\\ Advancing...').\n# $this->generateOutput(' | Advancing...').\n# $this->generateOutput('\
\ | Done...').\n# \\PHP_EOL.\n# $this->generateOutput(' - Starting Again...').\n\
# $this->generateOutput(' \\\\ Starting Again...').\n# $this->generateOutput('\
\ \\\\ Done Again...').\n# \\PHP_EOL,\n# stream_get_contents($output->getStream())\n\
# );\n# }\n# \n# public function testNonDecoratedOutput()\n# {\n# $bar = new ProgressIndicator($output\
\ = $this->getOutputStream(false));\n# \n# $bar->start('Starting...');\n# $bar->advance();\n\
# $bar->advance();\n# $bar->setMessage('Midway...');\n# $bar->advance();\n# $bar->advance();\n\
# $bar->finish('Done...');\n# \n# rewind($output->getStream());\n# \n# $this->assertEquals(\n\
# ' Starting...'.\\PHP_EOL.\n# ' Midway...'.\\PHP_EOL.\n# ' Done...'.\\PHP_EOL.\\\
PHP_EOL,\n# stream_get_contents($output->getStream())\n# );\n# }\n# \n# public\
\ function testCustomIndicatorValues()\n# {\n# $bar = new ProgressIndicator($output\
\ = $this->getOutputStream(), null, 100, ['a', 'b', 'c']);\n# \n# $bar->start('Starting...');\n\
# usleep(101000);\n# $bar->advance();\n# usleep(101000);\n# $bar->advance();\n\
# usleep(101000);\n# $bar->advance();\n# \n# rewind($output->getStream());\n#\
\ \n# $this->assertEquals(\n# $this->generateOutput(' a Starting...').\n# $this->generateOutput('\
\ b Starting...').\n# $this->generateOutput(' c Starting...').\n# $this->generateOutput('\
\ a Starting...'),\n# stream_get_contents($output->getStream())\n# );\n# }\n#\
\ \n# public function testCannotSetInvalidIndicatorCharacters()\n# {\n# $this->expectException(\\\
InvalidArgumentException::class);\n# $this->expectExceptionMessage('Must have\
\ at least 2 indicator value characters.');\n# new ProgressIndicator($this->getOutputStream(),\
\ null, 100, ['1']);\n# }\n# \n# public function testCannotStartAlreadyStartedIndicator()\n\
# {\n# $bar = new ProgressIndicator($this->getOutputStream());\n# $bar->start('Starting...');\n\
# \n# $this->expectException(\\LogicException::class);\n# $this->expectExceptionMessage('Progress\
\ indicator already started.');\n# \n# $bar->start('Starting Again.');\n# }\n\
# \n# public function testCannotAdvanceUnstartedIndicator()\n# {\n# $this->expectException(\\\
LogicException::class);\n# $this->expectExceptionMessage('Progress indicator has\
\ not yet been started.');\n# $bar = new ProgressIndicator($this->getOutputStream());\n\
# $bar->advance();\n# }\n# \n# public function testCannotFinishUnstartedIndicator()\n\
# {\n# $this->expectException(\\LogicException::class);\n# $this->expectExceptionMessage('Progress\
\ indicator has not yet been started.');\n# $bar = new ProgressIndicator($this->getOutputStream());\n\
# $bar->finish('Finished');\n# }\n# \n# /**\n# * @dataProvider provideFormat"
- name: provideFormat
visibility: public
parameters: []
comment: '# * Provides each defined format.'
- name: getOutputStream
visibility: protected
parameters:
- name: decorated
default: 'true'
- name: verbosity
default: StreamOutput::VERBOSITY_NORMAL
comment: null
- name: generateOutput
visibility: protected
parameters:
- name: expected
comment: null
traits:
- PHPUnit\Framework\TestCase
- Symfony\Component\Console\Helper\ProgressIndicator
- Symfony\Component\Console\Output\StreamOutput
interfaces: []