File: shell_test.php

package info (click to toggle)
postfixadmin 2.3.5-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 6,200 kB
  • sloc: php: 25,767; xml: 14,485; perl: 964; sh: 664; python: 169; makefile: 84
file content (38 lines) | stat: -rw-r--r-- 1,285 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
    // $Id: shell_test.php,v 1.9 2005/07/27 15:54:19 lastcraft Exp $
    
    require_once(dirname(__FILE__) . '/../shell_tester.php');
    
    class TestOfShell extends UnitTestCase {
        
        function testEcho() {
            $shell = &new SimpleShell();
            $this->assertIdentical($shell->execute('echo Hello'), 0);
            $this->assertPattern('/Hello/', $shell->getOutput());
        }
        
        function testBadCommand() {
            $shell = &new SimpleShell();
            $this->assertNotEqual($ret = $shell->execute('blurgh! 2>&1'), 0);
        }
    }
    
    class TestOfShellTesterAndShell extends ShellTestCase {
        
        function testEcho() {
            $this->assertTrue($this->execute('echo Hello'));
            $this->assertExitCode(0);
            $this->assertoutput('Hello');
        }
        
        function testFileExistence() {
            $this->assertFileExists(dirname(__FILE__) . '/all_tests.php');
            $this->assertFileNotExists('wibble');
        }
        
        function testFilePatterns() {
            $this->assertFilePattern('/all_tests/i', dirname(__FILE__) . '/all_tests.php');
            $this->assertNoFilePattern('/sputnik/i', dirname(__FILE__) . '/all_tests.php');
        }
    }
?>