Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Dec 26, 2023
1 parent 520923f commit 5c0aa9a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/Feature/RunTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,38 @@ class Foo { protected \$bar; public function baz() {} }
]
]);


it('fixes specific files', function (string $before, string $after) {
File::makeDirectory($dir = stubsPath('vendor/foo/bar'), recursive: true, force: true);
File::put($foo = stubsPath('vendor/foo/bar/Foo.php'), $before);
File::put($bar = stubsPath('vendor/foo/bar/Bar.php'), $before);

$this->artisan('run', [
'paths' => [$foo, $bar],
'--dir' => stubsPath(),
'--annotate' => 'internal',
'--methods' => 'public',
'--properties' => 'protected',
])->assertSuccessful();

expect(File::get($foo))->toEqual($after);
expect(File::get($bar))->toEqual($after);

File::delete($dir);
})->with([
[
<<<PHP
<?php
final class Foo { private \$bar; private function baz() {} }
PHP,

<<<PHP
<?php
/**
* @internal
*/
class Foo { protected \$bar; public function baz() {} }
PHP
]
]);

0 comments on commit 5c0aa9a

Please sign in to comment.