Line | |
---|
1 | <?php |
---|
2 | // $Id: shell_test.php 1529 2007-06-04 18:33:09Z lastcraft $ |
---|
3 | require_once(dirname(__FILE__) . '/../autorun.php'); |
---|
4 | require_once(dirname(__FILE__) . '/../shell_tester.php'); |
---|
5 | |
---|
6 | class TestOfShell extends UnitTestCase { |
---|
7 | |
---|
8 | function testEcho() { |
---|
9 | $shell = &new SimpleShell(); |
---|
10 | $this->assertIdentical($shell->execute('echo Hello'), 0); |
---|
11 | $this->assertPattern('/Hello/', $shell->getOutput()); |
---|
12 | } |
---|
13 | |
---|
14 | function testBadCommand() { |
---|
15 | $shell = &new SimpleShell(); |
---|
16 | $this->assertNotEqual($ret = $shell->execute('blurgh! 2>&1'), 0); |
---|
17 | } |
---|
18 | } |
---|
19 | |
---|
20 | class TestOfShellTesterAndShell extends ShellTestCase { |
---|
21 | |
---|
22 | function testEcho() { |
---|
23 | $this->assertTrue($this->execute('echo Hello')); |
---|
24 | $this->assertExitCode(0); |
---|
25 | $this->assertoutput('Hello'); |
---|
26 | } |
---|
27 | |
---|
28 | function testFileExistence() { |
---|
29 | $this->assertFileExists(dirname(__FILE__) . '/all_tests.php'); |
---|
30 | $this->assertFileNotExists('wibble'); |
---|
31 | } |
---|
32 | |
---|
33 | function testFilePatterns() { |
---|
34 | $this->assertFilePattern('/all[_ ]tests/i', dirname(__FILE__) . '/all_tests.php'); |
---|
35 | $this->assertNoFilePattern('/sputnik/i', dirname(__FILE__) . '/all_tests.php'); |
---|
36 | } |
---|
37 | } |
---|
38 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.