Skip to content

Commit

Permalink
Add proof tast name with empty task name property sets by child class
Browse files Browse the repository at this point in the history
  • Loading branch information
alquerci authored and thePanz committed Oct 17, 2022
1 parent 9c63e5d commit f8ea8b7
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion tests/TaskTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -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();
Expand Down Expand Up @@ -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';
}
}

0 comments on commit f8ea8b7

Please sign in to comment.