Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry committed May 31, 2018
1 parent 151e40a commit 9d09a94
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 22 deletions.
20 changes: 14 additions & 6 deletions tests/Console/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,22 @@ public function test_it_can_display_the_version_when_no_specific_version_is_give
$this->assertSame(0, $appTester->getStatusCode());

$expected = <<<'EOF'
Box (repo)
Box version 3.x-dev@151e40a

EOF;

$actual = $appTester->getDisplay(true);
$actual = preg_replace(
'/Box version .+@[a-z\d]{7}/',
'Box version 3.x-dev@151e40a',
$appTester->getDisplay(true)
);

$this->assertSame($expected, $actual);
}

public function test_it_can_display_the_version_when_a_specific_version_is_given(): void
{
$application = new Application('Box', '1.2.3');
$application = new Application('Box', '1.2.3', '2018-04-29 19:33:12');
$application->setAutoExit(false);
$application->setCatchExceptions(false);

Expand All @@ -61,7 +65,7 @@ public function test_it_can_display_the_version_when_a_specific_version_is_given
$this->assertSame(0, $appTester->getStatusCode());

$expected = <<<'EOF'
Box version 1.2.3 build @git-commit@
Box version 1.2.3 2018-04-29 19:33:12

EOF;

Expand Down Expand Up @@ -89,7 +93,7 @@ public function test_get_helper_menu(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
Usage:
command [options] [arguments]
Expand All @@ -116,7 +120,11 @@ public function test_get_helper_menu(): void

EOF;

$actual = $appTester->getDisplay(true);
$actual = preg_replace(
'/Box version .+@[a-z\d]{7}/',
'Box version 3.x-dev@151e40a',
$appTester->getDisplay(true)
);

$this->assertSame($expected, $actual);
}
Expand Down
38 changes: 22 additions & 16 deletions tests/Console/Command/CompileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function test_it_can_build_a_PHAR_file(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -337,7 +337,7 @@ public function test_it_can_build_a_PHAR_without_any_configuration(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading without a configuration file.
Expand Down Expand Up @@ -539,7 +539,7 @@ public function test_it_can_build_a_PHAR_with_complete_mapping(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -775,7 +775,7 @@ public function test_it_can_build_a_PHAR_file_in_verbose_mode(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -874,7 +874,7 @@ public function test_it_can_build_a_PHAR_file_in_very_verbose_mode(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -992,7 +992,7 @@ public function test_it_can_build_a_PHAR_file_in_debug_mode(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -1682,7 +1682,7 @@ public function test_it_can_build_a_PHAR_overwriting_an_existing_one_in_verbose_
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -1939,7 +1939,7 @@ public function test_it_can_build_a_PHAR_with_a_custom_banner(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -2000,7 +2000,7 @@ public function test_it_can_build_a_PHAR_with_a_stub_file(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -2059,7 +2059,7 @@ public function test_it_can_build_a_PHAR_with_the_default_stub_file(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -2128,7 +2128,7 @@ public function test_it_can_build_a_PHAR_without_a_main_script(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -2197,7 +2197,7 @@ public function test_it_can_build_an_empty_PHAR(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -2264,7 +2264,7 @@ public function test_it_can_build_a_PHAR_with_compressed_code(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -2334,7 +2334,7 @@ public function test_it_can_build_a_PHAR_in_a_non_existent_directory(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -2480,7 +2480,7 @@ public function test_it_can_build_a_PHAR_file_without_a_shebang_line(): void
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -2563,7 +2563,7 @@ public function test_it_can_build_a_PHAR_with_an_output_which_does_not_have_a_PH
/_____/\____/_/|_|
Box (repo)
Box version 3.x-dev@151e40a
// Loading the configuration file "/path/to/box.json.dist".
Expand Down Expand Up @@ -2744,6 +2744,12 @@ private function normalizeDisplay(string $display)
$display
);

$display = preg_replace(
'/Box version .+@[a-z\d]{7}/',
'Box version 3.x-dev@151e40a',
$display
);

return DisplayNormalizer::removeTrailingSpaces($display);
}

Expand Down

0 comments on commit 9d09a94

Please sign in to comment.