From 322bb9cd2be9e51422cb2b82684692e825c2bfb7 Mon Sep 17 00:00:00 2001 From: brettp Date: Fri, 2 Oct 2009 18:40:04 +0000 Subject: Added simpletest and start of unit tests. git-svn-id: http://code.elgg.org/elgg/trunk@3503 36083f99-b078-4883-b0ff-0f9b5a30f544 --- vendors/simpletest/test/shell_tester_test.php | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 vendors/simpletest/test/shell_tester_test.php (limited to 'vendors/simpletest/test/shell_tester_test.php') diff --git a/vendors/simpletest/test/shell_tester_test.php b/vendors/simpletest/test/shell_tester_test.php new file mode 100755 index 000000000..e536dcebd --- /dev/null +++ b/vendors/simpletest/test/shell_tester_test.php @@ -0,0 +1,42 @@ +_mock_shell; + } + + function testGenericEquality() { + $this->assertEqual('a', 'a'); + $this->assertNotEqual('a', 'A'); + } + + function testExitCode() { + $this->_mock_shell = &new MockSimpleShell(); + $this->_mock_shell->setReturnValue('execute', 0); + $this->_mock_shell->expectOnce('execute', array('ls')); + $this->assertTrue($this->execute('ls')); + $this->assertExitCode(0); + } + + function testOutput() { + $this->_mock_shell = &new MockSimpleShell(); + $this->_mock_shell->setReturnValue('execute', 0); + $this->_mock_shell->setReturnValue('getOutput', "Line 1\nLine 2\n"); + $this->assertOutput("Line 1\nLine 2\n"); + } + + function testOutputPatterns() { + $this->_mock_shell = &new MockSimpleShell(); + $this->_mock_shell->setReturnValue('execute', 0); + $this->_mock_shell->setReturnValue('getOutput', "Line 1\nLine 2\n"); + $this->assertOutputPattern('/line/i'); + $this->assertNoOutputPattern('/line 2/'); + } +} +?> \ No newline at end of file -- cgit v1.2.3