1 | <?php |
||
12 | class UtilTest extends \PHPUnit_Framework_TestCase |
||
13 | { |
||
14 | /** |
||
15 | * Tests Util::isValid |
||
16 | */ |
||
17 | public function testIsValid() |
||
18 | { |
||
19 | $this->assertTrue(Util::isValid('pre-commit')); |
||
20 | $this->assertTrue(Util::isValid('pre-push')); |
||
21 | $this->assertTrue(Util::isValid('commit-msg')); |
||
22 | $this->assertFalse(Util::isValid('foo')); |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Tests Util::getValidHooks |
||
27 | */ |
||
28 | public function testGetValidHooks() |
||
29 | { |
||
30 | $this->assertTrue(array_key_exists('pre-commit', Util::getValidHooks())); |
||
31 | $this->assertTrue(array_key_exists('pre-push', Util::getValidHooks())); |
||
32 | $this->assertTrue(array_key_exists('commit-msg', Util::getValidHooks())); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Tests Util::getHooks |
||
37 | */ |
||
38 | public function testGetHooks() |
||
39 | { |
||
40 | $this->assertTrue(in_array('pre-commit', Util::getHooks())); |
||
41 | $this->assertTrue(in_array('pre-push', Util::getHooks())); |
||
42 | $this->assertTrue(in_array('commit-msg', Util::getHooks())); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Tests Util::getActionType |
||
47 | */ |
||
48 | public function testGetActionType() |
||
49 | { |
||
50 | $this->assertEquals('php', Util::getActionType('\\Foo\\Bar')); |
||
51 | $this->assertEquals('cli', Util::getActionType('echo foo')); |
||
52 | $this->assertEquals('cli', Util::getActionType('/usr/local/bin/phpunit.phar')); |
||
53 | } |
||
54 | } |
||
55 |