Skip to content

Commit

Permalink
Fix failing test and unskip tests in SchemaShell::create()
Browse files Browse the repository at this point in the history
The tests were accidentally skipped when tests for --exclude were added
& fixed. Restore the gist of the previous tests.
  • Loading branch information
markstory committed Mar 5, 2013
1 parent 4a0df83 commit cfc10a7
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
Expand Up @@ -404,6 +404,7 @@ public function testGenerateModels() {
* @return void
*/
public function testGenerateExclude() {
Configure::write('Acl.database', 'test');
$this->db->cacheSources = false;
$this->Shell->params = array(
'connection' => 'test',
Expand Down Expand Up @@ -456,28 +457,26 @@ public function testCreateNoArgs() {
public function testCreateWithTableArgs() {
$db = ConnectionManager::getDataSource('test');
$sources = $db->listSources();
if (in_array('acos', $sources)) {
$this->markTestSkipped('acos table already exists, cannot try to create it again.');
if (in_array('i18n', $sources)) {
$this->markTestSkipped('i18n table already exists, cannot try to create it again.');
}
$this->Shell->params = array(
'connection' => 'test',
'name' => 'DbAcl',
'name' => 'I18n',
'path' => APP . 'Config' . DS . 'Schema'
);
$this->Shell->args = array('DbAcl', 'acos');
$this->Shell->args = array('I18n', 'i18n');
$this->Shell->startup();
$this->Shell->expects($this->any())->method('in')->will($this->returnValue('y'));
$this->Shell->create();

$db = ConnectionManager::getDataSource('test');
$db->cacheSources = false;
$sources = $db->listSources();
$this->assertTrue(in_array($db->config['prefix'] . 'acos', $sources), 'acos should be present.');
$this->assertFalse(in_array($db->config['prefix'] . 'aros', $sources), 'aros should not be found.');
$this->assertFalse(in_array('aros_acos', $sources), 'aros_acos should not be found.');
$this->assertTrue(in_array($db->config['prefix'] . 'i18n', $sources), 'i18n should be present.');

$schema = new DbAclSchema();
$db->execute($db->dropSchema($schema, 'acos'));
$schema = new I18nSchema();
$db->execute($db->dropSchema($schema, 'i18n'));
}

/**
Expand Down

0 comments on commit cfc10a7

Please sign in to comment.