Skip to content
Browse files

some more testing stuff

git-svn-id: http://svn.php.net/repository/pear/packages/Net_IPv4/trunk@208231 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 086eb22 commit efae6aacad8635f991f96e4f41c0f7ace95d5200 @winks winks committed
Showing with 103 additions and 0 deletions.
  1. +80 −0 tests/SimpleTestListener.php
  2. +23 −0 tests/net_ipv4.phpt
View
80 tests/SimpleTestListener.php
@@ -0,0 +1,80 @@
+<?php
+require_once 'PHPUnit2/Framework/TestListener.php';
+
+class SimpleTestListener
+implements PHPUnit2_Framework_TestListener
+{
+ public function
+ addError(PHPUnit2_Framework_Test $test, Exception $e)
+ {
+ printf(
+ "Error while running test '%s'.\n",
+ $test->getName()
+ );
+ }
+
+ public function
+ addFailure(PHPUnit2_Framework_Test $test,
+ PHPUnit2_Framework_AssertionFailedError $e)
+ {
+ printf(
+ "Test '%s' failed.\n",
+ $test->getName()
+ );
+ }
+
+ public function
+ addIncompleteTest(PHPUnit2_Framework_Test $test,
+ Exception $e)
+ {
+ printf(
+ "Test '%s' is incomplete.\n",
+ $test->getName()
+ );
+ }
+
+ public function
+ addSkippedTest(PHPUnit2_Framework_Test $test,
+ Exception $e)
+ {
+ printf(
+ "Test '%s' has been skipped.\n",
+ $test->getName()
+ );
+ }
+
+ public function startTest(PHPUnit2_Framework_Test $test)
+ {
+ printf(
+ "Test '%s' started.\n",
+ $test->getName()
+ );
+ }
+
+ public function endTest(PHPUnit2_Framework_Test $test)
+ {
+ printf(
+ "Test '%s' ended.\n",
+ $test->getName()
+ );
+ }
+
+ public function
+ startTestSuite(PHPUnit2_Framework_TestSuite $suite)
+ {
+ printf(
+ "TestSuite '%s' started.\n",
+ $suite->getName()
+ );
+ }
+
+ public function
+ endTestSuite(PHPUnit2_Framework_TestSuite $suite)
+ {
+ printf(
+ "TestSuite '%s' ended.\n",
+ $suite->getName()
+ );
+ }
+}
+?>
View
23 tests/net_ipv4.phpt
@@ -0,0 +1,23 @@
+--TEST--
+PEAR::Net_IPv4
+--FILE--
+require_once 'IPv4Test.php';
+require_once 'SimpleTestListener.php';
+require_once 'PHPUnit2/Framework/TestResult.php';
+require_once 'PHPUnit2/Framework/TestSuite.php';
+
+$suite = new PHPUnit2_Framework_TestSuite('IPv4Test');
+$result = new PHPUnit2_Framework_TestResult;
+$result->addListener(new SimpleTestListener);
+$suite->run($result);
+--EXPECT--
+TestSuite 'IPv4Test' started.
+Test 'test_atoh' started.
+Test 'test_atoh' ended.
+Test 'test_htoa' started.
+Test 'test_htoa' ended.
+Test 'test_validateIP' started.
+Test 'test_validateIP' ended.
+Test 'test_ip2double' started.
+Test 'test_ip2double' ended.
+TestSuite 'IPv4Test' ended.

0 comments on commit efae6aa

Please sign in to comment.
Something went wrong with that request. Please try again.