ControllerTest.php 789 B

12345678910111213141516171819202122
  1. <?php
  2. class ControllerTest extends PHPUnit_Framework_TestCase
  3. {
  4. public function testContext()
  5. {
  6. list($server, $mysqlConfig) = require("test/config.php");
  7. $dbh = new PDO($mysqlConfig[4][0], $mysqlConfig[1], $mysqlConfig[2]);
  8. $dbh->exec("DROP DATABASE ".$mysqlConfig[4][1]);
  9. $dbh->exec("CREATE DATABASE ".$mysqlConfig[4][1]);
  10. \Entity\ModelBase::init($mysqlConfig);
  11. $context = new \Tools\Context($server, false);
  12. \Entity\ModelBase::setup();
  13. $moduleMan = new \Tools\ModuleManager($context);
  14. $this->assertTrue($context->router->overrideUrl("modulesPath", dirname(__FILE__)."/modules/"));
  15. $mod = $moduleMan->install("testController");
  16. $this->assertNotFalse($mod);
  17. $this->assertNotNull($mod);
  18. $this->assertInstanceOf("\MockIndexController", $context->serve());
  19. }
  20. }