| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
echo "testing TraxGenerator\n"; |
|---|
| 15 |
require_once 'testenv.php'; |
|---|
| 16 |
require_once 'inflector.php'; |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
if (!defined("PHPUnit2_MAIN_METHOD")) { |
|---|
| 20 |
define("PHPUnit2_MAIN_METHOD", "TraxGeneratorTest::main"); |
|---|
| 21 |
} |
|---|
| 22 |
|
|---|
| 23 |
require_once "PHPUnit2/Framework/TestCase.php"; |
|---|
| 24 |
require_once "PHPUnit2/Framework/TestSuite.php"; |
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
require_once "PHPUnit2/Framework/IncompleteTestError.php"; |
|---|
| 28 |
|
|---|
| 29 |
static $tmpdir; |
|---|
| 30 |
|
|---|
| 31 |
// Create a temporary directory to receive generated files |
|---|
| 32 |
// @todo <b>FIXME:</b> Is this platform independent? |
|---|
| 33 |
do { |
|---|
| 34 |
$tmpdir = '/tmp/traxtest' . mt_rand(0, 99999999); |
|---|
| 35 |
} while(!mkdir($tmpdir,0700)); |
|---|
| 36 |
define('TRAX_ROOT', $tmpdir); |
|---|
| 37 |
|
|---|
| 38 |
define('TRAX_ENV', 'test'); |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
Trax::$database_settings['test'] |
|---|
| 42 |
= array('phptype' => 'mysql', |
|---|
| 43 |
'database' => 'test_development', |
|---|
| 44 |
'hostspec' => 'localhost', |
|---|
| 45 |
'username' => 'root', |
|---|
| 46 |
'password' => '', |
|---|
| 47 |
'persistent' => true); |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
@ini_set('include_path','./mockDB:'.ini_get('include_path')); |
|---|
| 51 |
require_once "DB.php"; |
|---|
| 52 |
$db =& DB::Connect(Trax::$database_settings[TRAX_ENV], |
|---|
| 53 |
array('persistent' => true)); |
|---|
| 54 |
if (PEAR::isError($db) || is_a($db, 'DB_Error')) { |
|---|
| 55 |
PHPUnit2_Framework_Assert::fail("Unable to create database"); |
|---|
| 56 |
} |
|---|
| 57 |
$db->setFetchMode(DB_FETCHMODE_ASSOC); |
|---|
| 58 |
Trax::$active_record_connections[TRAX_ENV] =& $db; |
|---|
| 59 |
|
|---|
| 60 |
require_once "trax_generator.php"; |
|---|
| 61 |
require_once "action_view/helpers.php"; |
|---|
| 62 |
require_once "action_view/helpers/active_record_helper.php"; |
|---|
| 63 |
require_once "active_record.php"; |
|---|
| 64 |
require_once "trax_exceptions.php"; |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
function __autoload($class_name) { |
|---|
| 70 |
$file = Inflector::underscore($class_name).".php"; |
|---|
| 71 |
$file_org = $class_name.".php"; |
|---|
| 72 |
|
|---|
| 73 |
if(file_exists(Trax::$models_path."/$file")) { |
|---|
| 74 |
|
|---|
| 75 |
include_once(Trax::$models_path."/$file"); |
|---|
| 76 |
file_exists(TRAX_LIB_ROOT."/$file")) { |
|---|
| 77 |
|
|---|
| 78 |
include_once(TRAX_LIB_ROOT."/$file"); |
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
class TraxGeneratorTest extends PHPUnit2_Framework_TestCase { |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
* Runs the test methods of this class. |
|---|
| 91 |
* |
|---|
| 92 |
* @access public |
|---|
| 93 |
* @static |
|---|
| 94 |
*/ |
|---|
| 95 |
public static function main() { |
|---|
| 96 |
require_once "PHPUnit2/TextUI/TestRunner.php"; |
|---|
| 97 |
|
|---|
| 98 |
$suite = new PHPUnit2_Framework_TestSuite("TraxGeneratorTest"); |
|---|
| 99 |
$result = PHPUnit2_TextUI_TestRunner::run($suite); |
|---|
| 100 |
} |
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
* Set up dummy Trax work area |
|---|
| 104 |
* |
|---|
| 105 |
* Create a dummy Trax work area in the temporary directory |
|---|
| 106 |
* @access protected |
|---|
| 107 |
*/ |
|---|
| 108 |
protected function setUp() { |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
mkdir(TRAX_ROOT.'/controllers',0700,true); |
|---|
| 112 |
mkdir(TRAX_ROOT.'/helpers',0700,true); |
|---|
| 113 |
mkdir(TRAX_ROOT.'/models',0700,true); |
|---|
| 114 |
mkdir(TRAX_ROOT.'/views/layouts',0700,true); |
|---|
| 115 |
} |
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
* Remove the dummy Trax work area |
|---|
| 119 |
* |
|---|
| 120 |
* @access protected |
|---|
| 121 |
*/ |
|---|
| 122 |
protected function tearDown() { |
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
$this->rmrfdir(TRAX_ROOT); |
|---|
| 126 |
} |
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
* Remove all the contents of a directory |
|---|
| 130 |
* @param string $dir Name of directory to empty. Ends with '/' |
|---|
| 131 |
*/ |
|---|
| 132 |
private function rmrfdir($dir) { |
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
$dir_h = opendir($dir); |
|---|
| 136 |
|
|---|
| 137 |
if (!$dir_h) { |
|---|
| 138 |
return; |
|---|
| 139 |
} |
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
while (false !== ($item = readdir($dir_h))) { |
|---|
| 143 |
if (is_dir($dir.$item)) { |
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
if ( ($item != '.') && ($item != '..') ) { |
|---|
| 147 |
$this->rmrfdir($dir.$item.'/'); |
|---|
| 148 |
rmdir($dir.$item); |
|---|
| 149 |
} |
|---|
| 150 |
} else { |
|---|
| 151 |
|
|---|
| 152 |
// $item is not a directory. |
|---|
| 153 |
unlink($dir.$item); |
|---|
| 154 |
} |
|---|
| 155 |
} |
|---|
| 156 |
|
|---|
| 157 |
// Close the directory |
|---|
| 158 |
closedir($dir_h); |
|---|
| 159 |
} |
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
* Verify that generator_help() outputs a "Usage" message |
|---|
| 164 |
*/ |
|---|
| 165 |
public function testGenerator_help() { |
|---|
| 166 |
$tg = new TraxGenerator; |
|---|
| 167 |
ob_start(); |
|---|
| 168 |
$tg->generator_help(); |
|---|
| 169 |
$output = ob_get_clean(); |
|---|
| 170 |
$this->assertContains('Usage', $output); |
|---|
| 171 |
} |
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
* Verify that scaffold_help() outputs a "Usage" message |
|---|
| 175 |
*/ |
|---|
| 176 |
public function testScaffold_help() { |
|---|
| 177 |
$tg = new TraxGenerator; |
|---|
| 178 |
ob_start(); |
|---|
| 179 |
$tg->scaffold_help(); |
|---|
| 180 |
$output = ob_get_clean(); |
|---|
| 181 |
$this->assertContains('Usage', $output); |
|---|
| 182 |
} |
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
* Verify that controller_help() outputs a "Usage" message |
|---|
| 186 |
*/ |
|---|
| 187 |
public function testController_help() { |
|---|
| 188 |
$tg = new TraxGenerator; |
|---|
| 189 |
ob_start(); |
|---|
| 190 |
$tg->controller_help(); |
|---|
| 191 |
$output = ob_get_clean(); |
|---|
| 192 |
$this->assertContains('Usage', $output); |
|---|
| 193 |
} |
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
* Verify that model_help() outputs a "Usage" message |
|---|
| 197 |
*/ |
|---|
| 198 |
public function testModel_help() { |
|---|
| 199 |
$tg = new TraxGenerator; |
|---|
| 200 |
ob_start(); |
|---|
| 201 |
$tg->model_help(); |
|---|
| 202 |
$output = ob_get_clean(); |
|---|
| 203 |
$this->assertContains('Usage', $output); |
|---|
| 204 |
} |
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 |
* Verify that generate_controller() generates a controller |
|---|
| 208 |
* |
|---|
| 209 |
* We would like to test |
|---|
| 210 |
* {@link TraxGenerator::create_controller() create_controller()}, |
|---|
| 211 |
* {@link TraxGenerator::create_helper() create_helper()} |
|---|
| 212 |
* and {@link TraxGenerator::create_view() create_view()} in |
|---|
| 213 |
* isolation before we test |
|---|
| 214 |
* {@link TraxGenerator::generate_controller() generate_controller()} |
|---|
| 215 |
* but that's impossible because they depend on private variables |
|---|
| 216 |
* which are set only in generate_controller(). |
|---|
| 217 |
*/ |
|---|
| 218 |
public function testGenerate_controller() { |
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
$tg = new TraxGenerator; |
|---|
| 222 |
ob_start(); |
|---|
| 223 |
$tg->generate_controller('mumble'); |
|---|
| 224 |
$output = ob_get_clean(); |
|---|
| 225 |
$this->assertContains('create', $output); |
|---|
| 226 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 227 |
. '/controllers/mumble_controller.php')); |
|---|
| 228 |
$controller = file_get_contents(TRAX_ROOT |
|---|
| 229 |
. '/controllers/mumble_controller.php'); |
|---|
| 230 |
$this->assertContains('class MumbleController extends' |
|---|
| 231 |
. ' ApplicationController', $controller); |
|---|
| 232 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 233 |
. '/helpers/mumble_helper.php')); |
|---|
| 234 |
$this->assertTrue(is_dir(TRAX_ROOT . '/views/mumble')); |
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 |
// reports that it exists |
|---|
| 238 |
$tg = new TraxGenerator; |
|---|
| 239 |
ob_start(); |
|---|
| 240 |
$tg->generate_controller('mumble'); |
|---|
| 241 |
$output = ob_get_clean(); |
|---|
| 242 |
$this->assertContains('exists', $output); |
|---|
| 243 |
$this->assertTrue(file_exists(TRAX_ROOT |
|---|
| 244 |
. '/controllers/mumble_controller.php')); |
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
$tg = new TraxGenerator; |
|---|
| 248 |
ob_start(); |
|---|
| 249 |
$tg->generate_controller('store', 'manager'); |
|---|
| 250 |
$output = ob_get_clean(); |
|---|
| 251 |
$this->assertContains('create', $output); |
|---|
| 252 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 253 |
. '/controllers/store_controller.php')); |
|---|
| 254 |
$controller = file_get_contents(TRAX_ROOT |
|---|
| 255 |
. '/controllers/store_controller.php'); |
|---|
| 256 |
$this->assertContains('class StoreController extends' |
|---|
| 257 |
. ' ApplicationController', $controller); |
|---|
| 258 |
$this->assertTrue(is_file(TRAX_ROOT . '/helpers/store_helper.php')); |
|---|
| 259 |
$this->assertTrue(is_dir(TRAX_ROOT . '/views/store')); |
|---|
| 260 |
$this->assertTrue(is_file(TRAX_ROOT . '/views/store/manager.phtml')); |
|---|
| 261 |
$view = file_get_contents(TRAX_ROOT . '/views/store/manager.phtml'); |
|---|
| 262 |
$this->assertContains('Store->manager',$view); |
|---|
| 263 |
$this->assertContains('store/manager.phtml',$view); |
|---|
| 264 |
|
|---|
| 265 |
|
|---|
| 266 |
$tg = new TraxGenerator; |
|---|
| 267 |
ob_start(); |
|---|
| 268 |
$tg->generate_controller('account', array('customer','teller')); |
|---|
| 269 |
$output = ob_get_clean(); |
|---|
| 270 |
$this->assertContains('create', $output); |
|---|
| 271 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 272 |
. '/controllers/account_controller.php')); |
|---|
| 273 |
$controller = file_get_contents(TRAX_ROOT |
|---|
| 274 |
. '/controllers/account_controller.php'); |
|---|
| 275 |
$this->assertContains('class AccountController extends' |
|---|
| 276 |
. ' ApplicationController', $controller); |
|---|
| 277 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 278 |
. '/helpers/account_helper.php')); |
|---|
| 279 |
$this->assertTrue(is_dir(TRAX_ROOT . '/views/account')); |
|---|
| 280 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 281 |
. '/views/account/customer.phtml')); |
|---|
| 282 |
$view = file_get_contents(TRAX_ROOT . '/views/account/customer.phtml'); |
|---|
| 283 |
$this->assertContains('Account->customer',$view); |
|---|
| 284 |
$this->assertContains('account/customer.phtml',$view); |
|---|
| 285 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 286 |
. '/views/account/teller.phtml')); |
|---|
| 287 |
$view = file_get_contents(TRAX_ROOT . '/views/account/teller.phtml'); |
|---|
| 288 |
$this->assertContains('Account->teller',$view); |
|---|
| 289 |
$this->assertContains('account/teller.phtml',$view); |
|---|
| 290 |
|
|---|
| 291 |
|
|---|
| 292 |
$tg = new TraxGenerator; |
|---|
| 293 |
ob_start(); |
|---|
| 294 |
$tg->generate_controller('forum/admin'); |
|---|
| 295 |
$output = ob_get_clean(); |
|---|
| 296 |
$this->assertContains('create', $output); |
|---|
| 297 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 298 |
. '/controllers/forum/admin_controller.php')); |
|---|
| 299 |
$controller = file_get_contents(TRAX_ROOT |
|---|
| 300 |
. '/controllers/forum/admin_controller.php'); |
|---|
| 301 |
$this->assertContains('class AdminController extends' |
|---|
| 302 |
. ' ApplicationController', $controller); |
|---|
| 303 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 304 |
. '/helpers/forum/admin_helper.php')); |
|---|
| 305 |
$this->assertTrue(is_dir(TRAX_ROOT . '/views/forum/admin')); |
|---|
| 306 |
} |
|---|
| 307 |
|
|---|
| 308 |
|
|---|
| 309 |
* Verify that generate_model() generates a model |
|---|
| 310 |
*/ |
|---|
| 311 |
public function testGenerate_model() { |
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
$tg = new TraxGenerator; |
|---|
| 315 |
ob_start(); |
|---|
| 316 |
$tg->generate_model('CreditCard'); |
|---|
| 317 |
$output = ob_get_clean(); |
|---|
| 318 |
$this->assertContains('create', $output); |
|---|
| 319 |
$this->assertTrue(is_file(TRAX_ROOT . '/models/credit_card.php')); |
|---|
| 320 |
$model = file_get_contents(TRAX_ROOT . '/models/credit_card.php'); |
|---|
| 321 |
$this->assertContains('class CreditCard extends ActiveRecord', |
|---|
| 322 |
$model); |
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
$tg = new TraxGenerator; |
|---|
| 326 |
ob_start(); |
|---|
| 327 |
$tg->generate_model('soap_opera'); |
|---|
| 328 |
$output = ob_get_clean(); |
|---|
| 329 |
$this->assertContains('create', $output); |
|---|
| 330 |
$this->assertTrue(is_file(TRAX_ROOT . '/models/soap_opera.php')); |
|---|
| 331 |
$model = file_get_contents(TRAX_ROOT . '/models/soap_opera.php'); |
|---|
| 332 |
$this->assertContains('class SoapOpera extends ActiveRecord', |
|---|
| 333 |
$model); |
|---|
| 334 |
} |
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
* Verify that generate_scaffold() generates a model and controller |
|---|
| 338 |
*/ |
|---|
| 339 |
public function testGenerate_scaffold1() { |
|---|
| 340 |
|
|---|
| 341 |
|
|---|
| 342 |
$tg = new TraxGenerator; |
|---|
| 343 |
ob_start(); |
|---|
| 344 |
$tg->generate_scaffold('PersonName', 'membership'); |
|---|
| 345 |
|
|---|
| 346 |
$output = ob_get_clean(); |
|---|
| 347 |
$this->assertContains('create', $output); |
|---|
| 348 |
$this->assertNotContains('Error:', $output); |
|---|
| 349 |
$this->assertNotContains('Notice:', $output); |
|---|
| 350 |
|
|---|
| 351 |
|
|---|
| 352 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 353 |
. '/controllers/membership_controller.php')); |
|---|
| 354 |
$controller = file_get_contents(TRAX_ROOT |
|---|
| 355 |
. '/controllers/membership_controller.php'); |
|---|
| 356 |
$this->assertContains('class MembershipController extends' |
|---|
| 357 |
. ' ApplicationController', $controller); |
|---|
| 358 |
$this->assertNotContains('Error:', $controller); |
|---|
| 359 |
$this->assertNotContains('Notice:', $controller); |
|---|
| 360 |
|
|---|
| 361 |
|
|---|
| 362 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 363 |
. '/models/person_name.php')); |
|---|
| 364 |
$model = file_get_contents(TRAX_ROOT |
|---|
| 365 |
. '/models/person_name.php'); |
|---|
| 366 |
$this->assertContains('class PersonName extends' |
|---|
| 367 |
. ' ActiveRecord', $model); |
|---|
| 368 |
$this->assertNotContains('Error:', $model); |
|---|
| 369 |
$this->assertNotContains('Notice:', $model); |
|---|
| 370 |
|
|---|
| 371 |
|
|---|
| 372 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 373 |
. '/helpers/membership_helper.php')); |
|---|
| 374 |
$helper = file_get_contents(TRAX_ROOT |
|---|
| 375 |
. '/helpers/membership_helper.php'); |
|---|
| 376 |
$this->assertContains('MembershipController', $helper); |
|---|
| 377 |
$this->assertNotContains('Error:', $helper); |
|---|
| 378 |
$this->assertNotContains('Notice:', $helper); |
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
$this->assertTrue(is_dir(TRAX_ROOT . '/views/membership')); |
|---|
| 382 |
|
|---|
| 383 |
$this->assertTrue(is_file(TRAX_ROOT . '/views/membership/add.phtml')); |
|---|
| 384 |
$add = file_get_contents(TRAX_ROOT |
|---|
| 385 |
. '/views/membership/add.phtml'); |
|---|
| 386 |
$this->assertContains('New PersonName', $add); |
|---|
| 387 |
$this->assertNotContains('Error:', $add); |
|---|
| 388 |
$this->assertNotContains('Notice:', $add); |
|---|
| 389 |
|
|---|
| 390 |
$this->assertTrue(is_file(TRAX_ROOT . '/views/membership/edit.phtml')); |
|---|
| 391 |
$edit = file_get_contents(TRAX_ROOT |
|---|
| 392 |
. '/views/membership/edit.phtml'); |
|---|
| 393 |
$this->assertContains('Editing PersonName', $edit); |
|---|
| 394 |
$this->assertNotContains('Error:', $edit); |
|---|
| 395 |
$this->assertNotContains('Notice:', $edit); |
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 |
$this->assertTrue(is_file(TRAX_ROOT . '/views/membership/_form.phtml')); |
|---|
| 399 |
$_form = file_get_contents(TRAX_ROOT |
|---|
| 400 |
. '/views/membership/_form.phtml'); |
|---|
| 401 |
$this->assertContains('PersonName', $_form); |
|---|
| 402 |
$this->assertNotContains('Error:', $_form); |
|---|
| 403 |
$this->assertNotContains('Notice:', $_form); |
|---|
| 404 |
|
|---|
| 405 |
$this->assertTrue(is_file(TRAX_ROOT . '/views/membership/index.phtml')); |
|---|
| 406 |
$index = file_get_contents(TRAX_ROOT |
|---|
| 407 |
. '/views/membership/index.phtml'); |
|---|
| 408 |
$this->assertContains('Listing PersonNames', $index); |
|---|
| 409 |
$this->assertNotContains('Error:', $index); |
|---|
| 410 |
$this->assertNotContains('Notice:', $index); |
|---|
| 411 |
|
|---|
| 412 |
$this->assertTrue(is_file(TRAX_ROOT . '/views/membership/show.phtml')); |
|---|
| 413 |
$show = file_get_contents(TRAX_ROOT |
|---|
| 414 |
. '/views/membership/show.phtml'); |
|---|
| 415 |
$this->assertContains('PersonName', $show); |
|---|
| 416 |
$this->assertNotContains('Error:', $show); |
|---|
| 417 |
$this->assertNotContains('Notice:', $show); |
|---|
| 418 |
|
|---|
| 419 |
|
|---|
| 420 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 421 |
. '/views/layouts/membership.phtml')); |
|---|
| 422 |
$layout = file_get_contents(TRAX_ROOT |
|---|
| 423 |
. '/views/layouts/membership.phtml'); |
|---|
| 424 |
$this->assertContains('membership', $layout); |
|---|
| 425 |
} |
|---|
| 426 |
|
|---|
| 427 |
|
|---|
| 428 |
* Verify that generate_scaffold() defaults controller from model |
|---|
| 429 |
*/ |
|---|
| 430 |
public function testGenerate_scaffold2() { |
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 |
$tg = new TraxGenerator; |
|---|
| 434 |
ob_start(); |
|---|
| 435 |
$tg->generate_scaffold('PersonName',null); |
|---|
| 436 |
$output = ob_get_clean(); |
|---|
| 437 |
$this->assertContains('create', $output); |
|---|
| 438 |
$this->assertNotContains('Error:', $output); |
|---|
| 439 |
$this->assertNotContains('Notice:', $output); |
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 443 |
. '/controllers/person_name_controller.php')); |
|---|
| 444 |
$controller = file_get_contents(TRAX_ROOT |
|---|
| 445 |
. '/controllers/person_name_controller.php'); |
|---|
| 446 |
$this->assertContains('class PersonNameController extends' |
|---|
| 447 |
. ' ApplicationController', $controller); |
|---|
| 448 |
$this->assertNotContains('Error:', $controller); |
|---|
| 449 |
$this->assertNotContains('Notice:', $controller); |
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
$this->assertTrue(is_file(TRAX_ROOT |
|---|
| 453 |
. '/models/person_name.php')); |
|---|
| 454 |
$model = file_get_contents(TRAX_ROOT |
|---|
| 455 |
. '/models/person_name.php'); |
|---|
| 456 |
$this->assertContains('class PersonName extends' |
|---|
| 457 |
. ' ActiveRecord', $model); |
|---|
| 458 |
$this |
|---|