forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.x] Fixes
GeneratorCommand
not able to prevent uppercase reserved (
laravel#48667) name such as `__CLASS__` Signed-off-by: Mior Muhammad Zaki <[email protected]>
- Loading branch information
1 parent
a3480a9
commit 598b10f
Showing
2 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Integration\Console; | ||
|
||
use Orchestra\Testbench\TestCase; | ||
|
||
class GeneratorCommandTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider reservedNamesDataProvider | ||
*/ | ||
public function testItCannotGenerateClassUsingReservedName($given) | ||
{ | ||
$this->artisan('make:command', ['name' => $given]) | ||
->expectsOutputToContain('The name "'.$given.'" is reserved by PHP.') | ||
->assertExitCode(0); | ||
} | ||
|
||
public static function reservedNamesDataProvider() | ||
{ | ||
yield ['__halt_compiler']; | ||
yield ['__HALT_COMPILER']; | ||
yield ['array']; | ||
yield ['ARRAY']; | ||
yield ['__class__']; | ||
yield ['__CLASS__']; | ||
} | ||
} |