Skip to content
Permalink
Browse files

Adding test cases for startup()

  • Loading branch information...
markstory committed Aug 8, 2009
1 parent 32754c4 commit 3c46b51b7ff1f2a85e7553bf1fa2c1e931b5a1eb
Showing with 34 additions and 4 deletions.
  1. +1 −3 cake/console/libs/schema.php
  2. +33 −1 cake/tests/cases/console/libs/schema.test.php
@@ -1,6 +1,4 @@
<?php
/* SVN FILE: $Id$ */
/**
* Command-line database management utility to automate programmer chores.
*
@@ -26,7 +24,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('File');
App::import('Core', 'File', false);
App::import('Model', 'CakeSchema', false);
/**
@@ -52,7 +52,6 @@
*/
class SchemaShellTest extends CakeTestCase {
/**
* startTest method
*
@@ -75,6 +74,39 @@ function endTest() {
ClassRegistry::flush();
}
/**
* test startup method
*
* @return void
**/
function testStartup() {
$this->Task->startup();
$this->assertTrue(isset($this->Task->Schema));
$this->assertTrue(is_a($this->Task->Schema, 'CakeSchema'));
$this->assertEqual($this->Task->Schema->name, 'App');
$this->assertEqual($this->Task->Schema->file, 'schema.php');
unset($this->Task->Schema);
$this->Task->params = array(
'name' => 'TestSchema'
);
$this->Task->startup();
$this->assertEqual($this->Task->Schema->name, 'TestSchema');
$this->assertEqual($this->Task->Schema->file, 'test_schema.php');
$this->assertEqual($this->Task->Schema->connection, 'default');
$this->assertEqual($this->Task->Schema->path, APP . 'config' . DS . 'schema');
unset($this->Task->Schema);
$this->Task->params = array(
'file' => 'other_file.php',
'connection' => 'test_suite',
'path' => '/test/path'
);
$this->Task->startup();
$this->assertEqual($this->Task->Schema->name, 'App');
$this->assertEqual($this->Task->Schema->file, 'other_file.php');
$this->assertEqual($this->Task->Schema->connection, 'test_suite');
$this->assertEqual($this->Task->Schema->path, '/test/path');
}
}
?>

0 comments on commit 3c46b51

Please sign in to comment.
You can’t perform that action at this time.