Skip to content

Commit

Permalink
Additional tests for filename generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jun 7, 2009
1 parent 44bffc5 commit 4141158
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions cake/tests/cases/console/libs/tasks/test.test.php
Expand Up @@ -404,6 +404,40 @@ function testBakeWithPlugin() {
$this->Task->bake('Helper', 'Form');
}

/**
* Test filename generation for each type + plugins
*
* @return void
**/
function testTestCaseFileName() {
$this->Task->path = '/my/path/tests/';

$result = $this->Task->testCaseFileName('Model', 'Post');
$expected = $this->Task->path . 'cases' . DS . 'models' . DS . 'post.test.php';
$this->assertEqual($result, $expected);

$result = $this->Task->testCaseFileName('Helper', 'Form');
$expected = $this->Task->path . 'cases' . DS . 'helpers' . DS . 'form.test.php';
$this->assertEqual($result, $expected);

$result = $this->Task->testCaseFileName('Controller', 'Posts');
$expected = $this->Task->path . 'cases' . DS . 'controllers' . DS . 'posts_controller.test.php';
$this->assertEqual($result, $expected);

$result = $this->Task->testCaseFileName('Behavior', 'Containable');
$expected = $this->Task->path . 'cases' . DS . 'behaviors' . DS . 'containable.test.php';
$this->assertEqual($result, $expected);

$result = $this->Task->testCaseFileName('Component', 'Auth');
$expected = $this->Task->path . 'cases' . DS . 'components' . DS . 'auth.test.php';
$this->assertEqual($result, $expected);

$this->Task->plugin = 'TestTest';
$result = $this->Task->testCaseFileName('Model', 'Post');
$expected = APP . 'plugins' . DS . 'test_test' . DS . 'tests' . DS . 'cases' . DS . 'models' . DS . 'post.test.php';
$this->assertEqual($result, $expected);
}

/**
* test execute with a type defined
*
Expand Down

0 comments on commit 4141158

Please sign in to comment.