Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge validating command features into base command #891

Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5edc84b
Move constant to base command
caendesilva Jan 30, 2023
037b997
Move handle method to base command
caendesilva Jan 30, 2023
38012f6
Move safeHandle method to base command
caendesilva Jan 30, 2023
b561422
Move handleException method to base command
caendesilva Jan 30, 2023
5806fc5
Bypass inheritance conflict
caendesilva Jan 30, 2023
bb99a62
Move tests for moved methods
caendesilva Jan 30, 2023
833eda1
Split out test for increased clarity
caendesilva Jan 30, 2023
22a7322
Add PHPDoc method description
caendesilva Jan 30, 2023
23db27f
Add line break
caendesilva Jan 30, 2023
048d9be
Introduce local variable to make unreadable code readable
caendesilva Jan 30, 2023
ddad744
Convert a 'sprintf()' call and concatenation to string interpolation
caendesilva Jan 30, 2023
cde73ae
Inline local variable
caendesilva Jan 30, 2023
5e342ff
Format sprintf arguments
caendesilva Jan 30, 2023
0c1af73
Deprecate arguments only used in tests adding unnecessary complexity
caendesilva Jan 30, 2023
0fc3ad7
Apply fixes from StyleCI
StyleCIBot Jan 30, 2023
a517b32
Create test case helper for setting safeHandle throw state
caendesilva Jan 30, 2023
4246db7
Use the added throw control helper
caendesilva Jan 30, 2023
c3e01c7
Revert "Bypass inheritance conflict"
caendesilva Jan 30, 2023
d1d695b
Rename helper method for conflicting method name
caendesilva Jan 30, 2023
6af9fe2
Remove deprecated arguments only used in test
caendesilva Jan 30, 2023
395996d
Remove tests causing more trouble than they're worth
caendesilva Jan 30, 2023
0a1c4d3
Split string in two strings and concatenation
caendesilva Jan 30, 2023
7cac05c
Introduce local variable
caendesilva Jan 30, 2023
5f9fa62
Extract common parts from if statement
caendesilva Jan 30, 2023
4c05568
Simplify 'if'
caendesilva Jan 30, 2023
984f4c7
Merge concatenated string into sprintf call
caendesilva Jan 30, 2023
986b5c8
Format sprintf call
caendesilva Jan 30, 2023
c27acf2
Apply fixes from StyleCI
StyleCIBot Jan 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Create test case helper for setting safeHandle throw state
  • Loading branch information
caendesilva committed Jan 30, 2023
commit a517b32c4d4445656dbb520201c5997817428734
11 changes: 11 additions & 0 deletions packages/testing/src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Hyde\Testing;

use function config;
use function file_get_contents;
use Hyde\Facades\Features;
use Hyde\Hyde;
Expand Down Expand Up @@ -55,4 +56,14 @@ protected function assertFileEqualsString(string $string, string $path, bool $st
$this->assertEquals(normalize_newlines($string), normalize_newlines(file_get_contents(Hyde::path($path))));
}
}

/**
* Disable the throwing of exceptions on console commands for the duration of the test.
*
* Note that this only affects commands using the {@see \Hyde\Console\Concerns\Command::safeHandle()} method.
*/
protected function throwOnConsoleException(bool $throw = true): void
{
config(['app.throw_on_console_exception' => $throw]);
}
}