Skip to content

Commit

Permalink
Fix issues in unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Sep 16, 2016
1 parent 7fab26d commit 1e81830
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/Common/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function get($item, $line, $dataType)

break;
case 'boolean':
$value = '(TRUE|FALSE)';
$value = '(true|TRUE|false|FALSE)';

break;
case 'string':
Expand Down
10 changes: 4 additions & 6 deletions tests/Commands/CreateLayoutCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testFilesExist()
CodeIgniterHelper::setDefaults($this->appPath);

$command = new CommandTester($this->command);
$command->execute([ '--bootstrap' => true]);
$command->execute([ '--bootstrap' => true ]);

$header = $this->appPath . '/views/layout/header.php';
$footer = $this->appPath . '/views/layout/footer.php';
Expand All @@ -64,12 +64,10 @@ public function testFolderExists()
{
$command = new CommandTester($this->command);

$command->execute([ '--bootstrap' => true]);
$command->execute([ '--bootstrap' => true]);
$command->execute([ '--bootstrap' => true ]);
$command->execute([ '--bootstrap' => true ]);

$message = 'The layout directory already exists!' . PHP_EOL;

$this->assertEquals($message, $command->getDisplay());
$this->assertRegExp('/layout directory already exists/', $command->getDisplay());

CodeIgniterHelper::setDefaults($this->appPath);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Commands/CreateModelCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function testNoLibraryInstalled()

$expected = 'Please install Wildfire or Doctrine!' . PHP_EOL;

$this->assertEquals($expected, $createCommand->getDisplay());
$this->assertRegExp('/Please install Wildfire or Doctrine/', $createCommand->getDisplay());

CodeIgniterHelper::setDefaults($this->appPath);
}
Expand Down
4 changes: 1 addition & 3 deletions tests/Commands/CreateViewCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ public function testFolderAlreadyExists()
$createCommand = new CommandTester($this->createCommand);
$createCommand->execute($options);

$expected = 'The "' . plural($this->table) . '" views folder already exists!' . PHP_EOL;

$this->assertEquals($expected, $createCommand->getDisplay());
$this->assertRegExp('/views folder already exists/', $createCommand->getDisplay());

CodeIgniterHelper::setDefaults($this->appPath);
}
Expand Down
16 changes: 4 additions & 12 deletions tests/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ public function testNoLibraryInstalled()
'--keep' => true
]);

$expected = 'Please install Wildfire or Doctrine!' . PHP_EOL;

$this->assertEquals($expected, $createCommand->getDisplay());
$this->assertRegExp('/Please install Wildfire or Doctrine/', $createCommand->getDisplay());

CodeIgniterHelper::setDefaults($this->appPath);
}
Expand Down Expand Up @@ -92,9 +90,7 @@ public function testNoLibrarySelected()
'--keep' => false
]);

$expected = 'Both Wildfire and Doctrine exists! Choose only one.' . PHP_EOL;

$this->assertEquals($expected, $createCommand->getDisplay());
$this->assertRegExp('/Choose only one/', $createCommand->getDisplay());

CodeIgniterHelper::setDefaults($this->appPath);
}
Expand Down Expand Up @@ -128,9 +124,7 @@ public function testFileExists()
'--keep' => true
]);

$expected = 'The "' . ucfirst($this->table) . '" controller already exists!' . PHP_EOL;

$this->assertEquals($expected, $createCommand->getDisplay());
$this->assertRegExp('/controller already exists/', $createCommand->getDisplay());

CodeIgniterHelper::setDefaults($this->appPath);
}
Expand All @@ -157,9 +151,7 @@ public function testWildfireCamelCasing()
'--keep' => true
]);

$expected = 'Wildfire does not support camel casing!' . PHP_EOL;

$this->assertEquals($expected, $createCommand->getDisplay());
$this->assertRegExp('/not support camel casing/', $createCommand->getDisplay());

CodeIgniterHelper::setDefaults($this->appPath);
}
Expand Down

0 comments on commit 1e81830

Please sign in to comment.