Skip to content

Commit 38e661d

Browse files
Add 'no tag yet' test case
1 parent 8b130b6 commit 38e661d

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/unit/Hook/Debug/SuccessTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use CaptainHook\App\Mockery as CHMockery;
1919
use Exception;
2020
use PHPUnit\Framework\TestCase;
21+
use SebastianFeldmann\Git\Operator\Info;
2122

2223
class SuccessTest extends TestCase
2324
{
@@ -47,4 +48,26 @@ public function testExecute(): void
4748

4849
$this->assertTrue(true);
4950
}
51+
52+
/**
53+
* Tests Debug::execute
54+
*/
55+
public function testExecuteWithoutTags(): void
56+
{
57+
$config = $this->createConfigMock(true);
58+
$io = $this->createIOMock();
59+
$repository = $this->createRepositoryMock();
60+
$action = new Action('\\' . Debug::class);
61+
$infoOperator = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->getMock();
62+
$infoOperator->method('getCurrentTag')->willThrowException(new Exception('foo'));
63+
64+
$io->expects($this->once())->method('getArguments')->willReturn(['foo' => 'bar']);
65+
$io->expects($this->atLeast(3))->method('write');
66+
$repository->expects($this->exactly(1))->method('getInfoOperator')->willReturn($infoOperator);
67+
68+
$debug = new Success();
69+
$debug->execute($config, $io, $repository, $action);
70+
71+
$this->assertTrue(true);
72+
}
5073
}

0 commit comments

Comments
 (0)