diff --git a/tests/TaskTestCase.php b/tests/TaskTestCase.php index 0c83bf34f..7dd644734 100644 --- a/tests/TaskTestCase.php +++ b/tests/TaskTestCase.php @@ -33,8 +33,12 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Task_TestCase extends UnitTestCase +class Doctrine_Task_TestCase extends Doctrine_UnitTestCase { + public function setUp() {} + + public function tearDown() {} + public function testDerivetasknameReturnsTheNameOfATaskFromItsClassName() { $this->assertEqual('migrate', Doctrine_Task::deriveTaskName('Doctrine_Task_Migrate')); @@ -59,6 +63,20 @@ public function testNameByDefaultIsDerivedFromTheNameOfTheClass() $this->assertEqual('test-case--test-task001', $oTask->getTaskName()); } + public function testNameByDefaultIsDerivedFromTheNameOfTheClass_withEmptyTaskNamePropertySetsByChildClass() + { + $task = new Doctrine_Task_TestCase_EmptyTaskNameTestTask(); + + $this->assertEqual('test-case--empty-task-name-test-task', $task->getTaskName()); + } + + public function testNameUseCustomNameThroughGetTaskNameMethod() + { + $task = new Doctrine_Task_TestCase_OverwrittenGetTaskNameMethodTestTask(); + + $this->assertEqual('foo', $task->getTaskName()); + } + public function testSettasknameSetsTheNameOfTheTask() { $oTask = new Doctrine_Task_TestCase_TestTask002(); @@ -151,3 +169,20 @@ class Doctrine_Task_TestCase_TestTask003 extends Doctrine_Task public function execute() {} } + +class Doctrine_Task_TestCase_EmptyTaskNameTestTask extends Doctrine_Task +{ + public $taskName = ''; + + public function execute() {} +} + +class Doctrine_Task_TestCase_OverwrittenGetTaskNameMethodTestTask extends Doctrine_Task +{ + public function execute() {} + + public function getTaskName() + { + return 'foo'; + } +}