Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
whitespace normalization
  • Loading branch information
AD7six committed Jul 26, 2009
1 parent 062f471 commit f64f4cb
Show file tree
Hide file tree
Showing 13 changed files with 187 additions and 41 deletions.
15 changes: 1 addition & 14 deletions cake/tests/cases/console/cake.test.php
Expand Up @@ -116,7 +116,7 @@ function stdout($string, $newline = true) {
* @return void
*/
function clear() {

}

/**
Expand Down Expand Up @@ -192,7 +192,6 @@ function testParseParams() {
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$params = array('cake.php');
$expected = array(
'app' => 'app',
Expand All @@ -204,7 +203,6 @@ function testParseParams() {
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$params = array(
'cake.php',
'-app',
Expand All @@ -220,7 +218,6 @@ function testParseParams() {
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$params = array(
'./cake.php',
'bake',
Expand All @@ -241,7 +238,6 @@ function testParseParams() {
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$params = array(
'./console/cake.php',
'bake',
Expand All @@ -260,7 +256,6 @@ function testParseParams() {
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$params = array(
'./console/cake.php',
'bake',
Expand All @@ -281,7 +276,6 @@ function testParseParams() {
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$params = array(
'./console/cake.php',
'-working',
Expand All @@ -307,11 +301,9 @@ function testParseParams() {
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$expected = array('./console/cake.php', 'schema', 'run', 'create');
$this->assertEqual($expected, $Dispatcher->args);


$params = array(
'/cake/1.2.x.x/cake/console/cake.php',
'-working',
Expand All @@ -335,7 +327,6 @@ function testParseParams() {
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$expected = array('/cake/1.2.x.x/cake/console/cake.php', 'schema', 'run', 'create');
$this->assertEqual($expected, $Dispatcher->args);
$params = array(
Expand All @@ -353,12 +344,10 @@ function testParseParams() {
'root' => 'C:\wamp\www\apps\cake'
);


$Dispatcher->params = $Dispatcher->args = array();
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$params = array(
'cake.php',
'-working',
Expand All @@ -377,7 +366,6 @@ function testParseParams() {
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$params = array(
'cake.php',
'-working',
Expand All @@ -399,7 +387,6 @@ function testParseParams() {
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);


$params = array(
'/home/amelo/dev/cake-common/cake/console/cake.php',
'-root',
Expand Down
10 changes: 7 additions & 3 deletions cake/tests/cases/console/libs/tasks/db_config.test.php
Expand Up @@ -33,7 +33,6 @@
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'db_config.php';
//require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php';


Mock::generatePartial(
'ShellDispatcher', 'TestDbConfigTaskMockShellDispatcher',
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
Expand All @@ -54,7 +53,7 @@ class TEST_DATABASE_CONFIG {
'database' => 'database_name',
'prefix' => '',
);

var $otherOne = array(
'driver' => 'mysql',
'persistent' => false,
Expand All @@ -73,6 +72,7 @@ class TEST_DATABASE_CONFIG {
* @subpackage cake.tests.cases.console.libs.tasks
*/
class DbConfigTaskTest extends CakeTestCase {

/**
* startTest method
*
Expand All @@ -88,6 +88,7 @@ function startTest() {
$this->Task->params['working'] = rtrim(APP, '/');
$this->Task->databaseClassName = 'TEST_DATABASE_CONFIG';
}

/**
* endTest method
*
Expand All @@ -98,6 +99,7 @@ function endTest() {
unset($this->Task, $this->Dispatcher);
ClassRegistry::flush();
}

/**
* Test the getConfig method.
*
Expand All @@ -108,6 +110,7 @@ function testGetConfig() {
$result = $this->Task->getConfig();
$this->assertEqual($result, 'otherOne');
}

/**
* test that initialize sets the path up.
*
Expand All @@ -118,8 +121,9 @@ function testInitialize() {
$this->Task->initialize();
$this->assertFalse(empty($this->Task->path));
$this->assertEqual($this->Task->path, APP . 'config' . DS);

}

/**
* test execute and by extension __interactive
*
Expand Down
17 changes: 15 additions & 2 deletions cake/tests/cases/console/libs/tasks/fixture.test.php
Expand Up @@ -47,19 +47,22 @@
'Shell', 'MockFixtureModelTask',
array('in', 'out', 'err', 'createFile', '_stop', 'getName', 'getTable', 'listAll')
);

/**
* FixtureTaskTest class
*
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class FixtureTaskTest extends CakeTestCase {

/**
* fixtures
*
* @var array
**/
var $fixtures = array('core.article', 'core.comment');

/**
* startTest method
*
Expand All @@ -75,6 +78,7 @@ function startTest() {
$this->Task->Dispatch->shellPaths = App::path('shells');
$this->Task->Template->initialize();
}

/**
* endTest method
*
Expand All @@ -85,6 +89,7 @@ function endTest() {
unset($this->Task, $this->Dispatcher);
ClassRegistry::flush();
}

/**
* test that initialize sets the path
*
Expand All @@ -97,6 +102,7 @@ function testConstruct() {
$expected = '/my/path/tests/fixtures/';
$this->assertEqual($Task->path, $expected);
}

/**
* test import option array generation
*
Expand All @@ -117,14 +123,15 @@ function testImportOptions() {
$result = $this->Task->importOptions('Article');
$expected = array();
$this->assertEqual($result, $expected);

$this->Task->setReturnValueAt(5, 'in', 'n');
$this->Task->setReturnValueAt(6, 'in', 'n');
$this->Task->setReturnValueAt(7, 'in', 'y');
$result = $this->Task->importOptions('Article');
$expected = array('fromTable' => true);
$this->assertEqual($result, $expected);
}

/**
* test generating a fixture with database conditions.
*
Expand All @@ -143,6 +150,7 @@ function testImportRecordsFromDatabaseWithConditions() {
$this->assertPattern('/Second Article/', $result, 'Missing import data %s');
$this->assertPattern('/Third Article/', $result, 'Missing import data %s');
}

/**
* test that execute passes runs bake depending with named model.
*
Expand All @@ -156,6 +164,7 @@ function testExecuteWithNamedModel() {
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
$this->Task->execute();
}

/**
* test that execute runs all() when args[0] = all
*
Expand All @@ -175,6 +184,7 @@ function testExecuteIntoAll() {
$this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/class CommentFixture/')));
$this->Task->execute();
}

/**
* test interactive mode of execute
*
Expand All @@ -183,7 +193,7 @@ function testExecuteIntoAll() {
function testExecuteInteractive() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';

$this->Task->setReturnValue('in', 'y');
$this->Task->Model->setReturnValue('getName', 'Article');
$this->Task->Model->setReturnValue('getTable', 'articles', array('Article'));
Expand All @@ -192,6 +202,7 @@ function testExecuteInteractive() {
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
$this->Task->execute();
}

/**
* Test that bake works
*
Expand Down Expand Up @@ -225,6 +236,7 @@ function testBake() {
$this->assertNoPattern('/var \$fields/', $result);
$this->assertNoPattern('/var \$records/', $result);
}

/**
* Test that file generation includes headers and correct path for plugins.
*
Expand All @@ -241,6 +253,7 @@ function testGenerateFixtureFile() {
$this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/\<\?php(.*)\?\>/ms')));
$result = $this->Task->generateFixtureFile('Article', array());
}

/**
* test generating files into plugins.
*
Expand Down

0 comments on commit f64f4cb

Please sign in to comment.