Permalink
Browse files

Support @test annotation. Remove dead code.

  • Loading branch information...
1 parent 4bbbd11 commit c63af8b2b2e9b4a38668b27ade1b8417f8a2bfed @sebastianbergmann committed Nov 7, 2006
Showing with 9 additions and 25 deletions.
  1. +0 −7 PHPUnit/Tests/Util/TestDox/NamePrettifierTest.php
  2. +9 −18 PHPUnit/Util/TestDox/NamePrettifier.php
@@ -103,12 +103,5 @@ public function testTestNameIsConvertedToASentence()
$this->assertEquals('This2 is a test', $this->namePrettifier->prettifyTestMethod('testThis2IsATest'));
$this->assertEquals('database_column_spec is set correctly', $this->namePrettifier->prettifyTestMethod('testdatabase_column_specIsSetCorrectly'));
}
-
- public function testIsATestIsFalseForNonTestMethods()
- {
- $this->assertFalse($this->namePrettifier->isATestMethod('setUp'));
- $this->assertFalse($this->namePrettifier->isATestMethod('tearDown'));
- $this->assertFalse($this->namePrettifier->isATestMethod('foo'));
- }
}
?>
@@ -75,22 +75,6 @@ class PHPUnit_Util_TestDox_NamePrettifier
protected $suffix = 'Test';
/**
- * Tests if a method is a test method.
- *
- * @param string $testMethodName
- * @return boolean
- * @access public
- */
- public function isATestMethod($testMethodName)
- {
- if (substr($testMethodName, 0, 4) == 'test') {
- return TRUE;
- }
-
- return FALSE;
- }
-
- /**
* Prettifies the name of a test class.
*
* @param string $testClassName
@@ -128,8 +112,15 @@ public function prettifyTestMethod($testMethodName)
$testMethodName = preg_replace('#\d+$#', '', $testMethodName);
$max = strlen($testMethodName);
- for ($i = 4; $i < $max; $i++) {
- if ($i > 4 &&
+ if (substr($testMethodName, 0, 4) == 'test') {
+ $offset = 4;
+ } else {
+ $offset = 0;
+ $testMethodName[0] = strtoupper($testMethodName[0]);
+ }
+
+ for ($i = $offset; $i < $max; $i++) {
+ if ($i > $offset &&
ord($testMethodName[$i]) >= 65 &&
ord($testMethodName[$i]) <= 90) {
$buffer .= ' ' . strtolower($testMethodName[$i]);

0 comments on commit c63af8b

Please sign in to comment.