| 1234567891011121314151617181920212223242526 |
- <?php
- class ContextTest extends PHPUnit_Framework_TestCase
- {
- public function testContext()
- {
- list($server, $mysqlConfig) = require("test/config.php");
- $dbh = new PDO($mysqlConfig[4][0], $mysqlConfig[1], $mysqlConfig[2]);
- $dbh->exec("DROP DATABASE ".$mysqlConfig[4][1]);
- $dbh->exec("CREATE DATABASE ".$mysqlConfig[4][1]);
- \Entity\ModelBase::init($mysqlConfig);
- $context = new \Tools\Context($server, false);
- \Entity\ModelBase::setup();
- $this->assertEquals("127.0.0.10", $context->ip);
- $this->assertEquals($context, \Tools\Context::getContext());
- try {
- $i = $context->undefinedAttribute;
- $this->fail("Expected exception");
- }
- catch (\Exception $e)
- { }
- }
- }
|