Skip to content

Commit b29c74b

Browse files
authored
Merge pull request #26 from dsbilling/master
Update Pint defaults
2 parents 3a68f06 + 7b45bb3 commit b29c74b

File tree

6 files changed

+43
-47
lines changed

6 files changed

+43
-47
lines changed

config/git-hooks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@
170170
'code_analyzers' => [
171171
'laravel_pint' => [
172172
'path' => env('LARAVEL_PINT_PATH', 'vendor/bin/pint'),
173-
'config' => env('LARAVEL_PINT_CONFIG', 'pint.json'),
174-
'preset' => env('LARAVEL_PINT_PRESET', 'psr12'),
173+
'config' => env('LARAVEL_PINT_CONFIG'),
174+
'preset' => env('LARAVEL_PINT_PRESET', 'laravel'),
175175
'file_extensions' => env('LARAVEL_PINT_FILE_EXTENSIONS', '/\.php$/'),
176176
],
177177
'php_code_sniffer' => [

src/Contracts/Hook.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ interface Hook
99
{
1010
/**
1111
* Get hook name
12-
*
13-
* @return string
1412
*/
1513
public function getName(): ?string;
1614
}

tests/Features/Commands/PostCommitTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
use Igorsgm\GitHooks\Git\Log;
77

88
test('Git Log is sent through HookPipes', function (string $logText) {
9-
// This approach is broken in the current version of Mockery
10-
// @TODO: Update this test once Pest or Mockery versions are updated
11-
// $postCommitHook1 = mock(PostCommitHook::class)->expect(
12-
// handle: fn (Log $log, Closure $closure) => expect($log->getHash())->toBe(mockCommitHash())
13-
// );
9+
// This approach is broken in the current version of Mockery
10+
// @TODO: Update this test once Pest or Mockery versions are updated
11+
// $postCommitHook1 = mock(PostCommitHook::class)->expect(
12+
// handle: fn (Log $log, Closure $closure) => expect($log->getHash())->toBe(mockCommitHash())
13+
// );
1414

1515
$postCommitHook1 = mock(PostCommitHook::class);
1616
$postCommitHook1->expects('handle')
17-
->withArgs(fn($log, $closure) => $log->getHash() === mockCommitHash());
17+
->withArgs(fn ($log, $closure) => $log->getHash() === mockCommitHash());
1818

1919
$postCommitHook2 = clone $postCommitHook1;
2020

@@ -29,13 +29,13 @@
2929
})->with('lastCommitLogText');
3030

3131
it('Returns 1 on HookFailException', function ($logText) {
32-
// This approach is broken in the current version of Mockery
33-
// @TODO: Update this test once Pest or Mockery versions are updated
34-
// $postCommitHook1 = mock(PostCommitHook::class)->expect(
35-
// handle: function (Log $log, Closure $closure) {
36-
// throw new HookFailException();
37-
// }
38-
// );
32+
// This approach is broken in the current version of Mockery
33+
// @TODO: Update this test once Pest or Mockery versions are updated
34+
// $postCommitHook1 = mock(PostCommitHook::class)->expect(
35+
// handle: function (Log $log, Closure $closure) {
36+
// throw new HookFailException();
37+
// }
38+
// );
3939

4040
$postCommitHook1 = mock(PostCommitHook::class);
4141
$postCommitHook1->expects('handle')

tests/Features/Commands/PreCommitTest.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
use Igorsgm\GitHooks\Git\ChangedFiles;
77

88
test('Sends ChangedFiles through HookPipes', function (string $listOfChangedFiles) {
9-
// This approach is broken in the current version of Mockery
10-
// @TODO: Update this test once Pest or Mockery versions are updated
11-
// $preCommitHook1 = mock(PreCommitHook::class)->expect(
12-
// handle: function (ChangedFiles $files, Closure $closure) use ($listOfChangedFiles) {
13-
// $firstChangedFile = (string) $files->getFiles()->first();
14-
// expect($firstChangedFile)->toBe($listOfChangedFiles);
15-
// }
16-
// );
9+
// This approach is broken in the current version of Mockery
10+
// @TODO: Update this test once Pest or Mockery versions are updated
11+
// $preCommitHook1 = mock(PreCommitHook::class)->expect(
12+
// handle: function (ChangedFiles $files, Closure $closure) use ($listOfChangedFiles) {
13+
// $firstChangedFile = (string) $files->getFiles()->first();
14+
// expect($firstChangedFile)->toBe($listOfChangedFiles);
15+
// }
16+
// );
1717
$preCommitHook1 = mock(PreCommitHook::class);
1818
$preCommitHook1->expects('handle')
1919
->andReturnUsing(function (ChangedFiles $files, Closure $closure) use ($listOfChangedFiles) {
@@ -34,20 +34,19 @@
3434
})->with('listOfChangedFiles');
3535

3636
it('Returns 1 on HookFailException', function ($listOfChangedFiles) {
37-
// This approach is broken in the current version of Mockery
38-
// @TODO: Update this test once Pest or Mockery versions are updated
39-
// $preCommitHook1 = mock(PreCommitHook::class)->expect(
40-
// handle: function (ChangedFiles $files, Closure $closure) {
41-
// throw new HookFailException();
42-
// }
43-
// );
37+
// This approach is broken in the current version of Mockery
38+
// @TODO: Update this test once Pest or Mockery versions are updated
39+
// $preCommitHook1 = mock(PreCommitHook::class)->expect(
40+
// handle: function (ChangedFiles $files, Closure $closure) {
41+
// throw new HookFailException();
42+
// }
43+
// );
4444
$preCommitHook1 = mock(PreCommitHook::class);
4545
$preCommitHook1->expects('handle')
4646
->andReturnUsing(function (ChangedFiles $files, Closure $closure) {
4747
throw new HookFailException();
4848
});
4949

50-
5150
$this->config->set('git-hooks.pre-commit', [
5251
$preCommitHook1,
5352
]);

tests/Features/Commands/PrePushTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
use Igorsgm\GitHooks\Git\Log;
66

77
test('Git Log is sent through HookPipes', function (string $logText) {
8-
// This approach is broken in the current version of Mockery
9-
// @TODO: Update this test once Pest or Mockery versions are updated
10-
// $prePushHook1 = mock(PostCommitHook::class)->expect(
11-
// handle: fn (Log $log, Closure $closure) => expect($log->getHash())->toBe(mockCommitHash())
12-
// );
8+
// This approach is broken in the current version of Mockery
9+
// @TODO: Update this test once Pest or Mockery versions are updated
10+
// $prePushHook1 = mock(PostCommitHook::class)->expect(
11+
// handle: fn (Log $log, Closure $closure) => expect($log->getHash())->toBe(mockCommitHash())
12+
// );
1313
$prePushHook1 = mock(PostCommitHook::class);
1414
$prePushHook1->expects('handle')
15-
->withArgs(fn(Log $log, Closure $closure) => $log->getHash() === mockCommitHash())
15+
->withArgs(fn (Log $log, Closure $closure) => $log->getHash() === mockCommitHash())
1616
->once();
1717

1818
$prePushHook2 = clone $prePushHook1;

tests/Features/Commands/PrepareCommitMessageTest.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,19 @@
3535
})->with('listOfChangedFiles');
3636

3737
it('Returns 1 on HookFailException', function ($listOfChangedFiles) {
38-
// This approach is broken in the current version of Mockery
39-
// @TODO: Update this test once Pest or Mockery versions are updated
40-
// $postCommitHook1 = mock(MessageHook::class)->expect(
41-
// handle: function (CommitMessage $commitMessage, Closure $closure) {
42-
// throw new HookFailException();
43-
// }
44-
// );
38+
// This approach is broken in the current version of Mockery
39+
// @TODO: Update this test once Pest or Mockery versions are updated
40+
// $postCommitHook1 = mock(MessageHook::class)->expect(
41+
// handle: function (CommitMessage $commitMessage, Closure $closure) {
42+
// throw new HookFailException();
43+
// }
44+
// );
4545
$postCommitHook1 = mock(MessageHook::class);
4646
$postCommitHook1->expects('handle')
4747
->andReturnUsing(function (CommitMessage $commitMessage, Closure $closure) {
4848
throw new HookFailException();
4949
});
5050

51-
5251
$this->config->set('git-hooks.prepare-commit-msg', [
5352
$postCommitHook1,
5453
]);

0 commit comments

Comments
 (0)