Skip to content

Commit

Permalink
[bug] standardize console width
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond committed Sep 24, 2021
1 parent 997ee1f commit 8e0c4ba
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<ini name="error_reporting" value="-1" />
<server name="KERNEL_CLASS" value="Zenstruck\Console\Test\Tests\Fixture\Kernel" />
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=0"/>
<env name="COLUMNS" value="120" />
</php>

<testsuites>
Expand Down
3 changes: 3 additions & 0 deletions tests/Fixture/FixtureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Style\SymfonyStyle;

/**
* @author Kevin Bond <kevinbond@gmail.com>
Expand Down Expand Up @@ -59,6 +60,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln("opt3 value: {$value}");
}

(new SymfonyStyle($input, $output))->success('Long link: https://github.com/zenstruck/console-test/blob/997ee1f66743342ffd9cd00a77613ebfa2efd2b8/src/CommandResult.php');

return (int) $input->getOption('code');
}

Expand Down
11 changes: 11 additions & 0 deletions tests/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,15 @@ public function can_turn_off_interaction(): void
->assertOutputNotContains('kbond')
;
}

/**
* @test
*/
public function terminal_width_is_standardized(): void
{
$this->executeConsoleCommand('fixture:command')
->assertOutputContains(' [OK] Long link: ')
->assertOutputContains(' https://github.com/zenstruck/console-test/blob/997ee1f66743342ffd9cd00a77613ebfa2efd2b8/src/CommandResult.php ')
;
}
}
12 changes: 12 additions & 0 deletions tests/UnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,16 @@ public function can_turn_off_interaction(): void
->assertOutputNotContains('kbond')
;
}

/**
* @test
*/
public function terminal_width_is_standardized(): void
{
TestCommand::for(new FixtureCommand())
->execute()
->assertOutputContains(' [OK] Long link: ')
->assertOutputContains(' https://github.com/zenstruck/console-test/blob/997ee1f66743342ffd9cd00a77613ebfa2efd2b8/src/CommandResult.php ')
;
}
}

0 comments on commit 8e0c4ba

Please sign in to comment.