| @@ 14-45 (lines=32) @@ | ||
| 11 | ||
| 12 | use CaptainHook\App\Git\CommitMessage; |
|
| 13 | ||
| 14 | class CapitalizeSubjectTest extends \PHPUnit_Framework_TestCase |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * Tests CapitalizeSubject::pass |
|
| 18 | */ |
|
| 19 | public function testPassSuccess() |
|
| 20 | { |
|
| 21 | $msg = new CommitMessage('Foo'); |
|
| 22 | $rule = new CapitalizeSubject(); |
|
| 23 | $this->assertTrue($rule->pass($msg)); |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Tests CapitalizeSubject::pass |
|
| 28 | */ |
|
| 29 | public function testPassFail() |
|
| 30 | { |
|
| 31 | $msg = new CommitMessage('foo'); |
|
| 32 | $rule = new CapitalizeSubject(); |
|
| 33 | $this->assertFalse($rule->pass($msg)); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * Tests CapitalizeSubject::pass |
|
| 38 | */ |
|
| 39 | public function testPassFailOnEmptyMessage() |
|
| 40 | { |
|
| 41 | $msg = new CommitMessage(''); |
|
| 42 | $rule = new CapitalizeSubject(); |
|
| 43 | $this->assertFalse($rule->pass($msg)); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| @@ 14-38 (lines=25) @@ | ||
| 11 | ||
| 12 | use CaptainHook\App\Git\CommitMessage; |
|
| 13 | ||
| 14 | class UseImperativeMoodTest extends \PHPUnit_Framework_TestCase |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * Tests UseImperativeMood::pass |
|
| 18 | */ |
|
| 19 | public function testPassSuccess() |
|
| 20 | { |
|
| 21 | $msg = new CommitMessage('Foo bar baz'); |
|
| 22 | $rule = new UseImperativeMood(); |
|
| 23 | $this->assertTrue($rule->pass($msg)); |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Tests UseImperativeMood::pass |
|
| 28 | */ |
|
| 29 | public function testPassFail() |
|
| 30 | { |
|
| 31 | $msg = new CommitMessage('Added some something'); |
|
| 32 | $rule = new UseImperativeMood(); |
|
| 33 | $this->assertFalse($rule->pass($msg)); |
|
| 34 | ||
| 35 | $hint = $rule->getHint(); |
|
| 36 | $this->assertTrue((bool) strpos($hint, 'imperative')); |
|
| 37 | } |
|
| 38 | } |
|
| 39 | ||