Replace constant DEBUG to use in Config. Remove start profiler from FrontController (moved to bootstrap).
This commit is contained in:
@ -64,9 +64,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testFind()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
$result = $this->model->find();
|
||||
$this->assertInstanceOf('MongoStatement', $result);
|
||||
$this->assertEquals('milk', $result->limit(2)->order(array('name' => -1))->fetch()->name);
|
||||
@ -83,9 +81,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGet()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
$result = $this->model->find()->limit(1)->order(array('name' => 1));
|
||||
$result = $result->fetch();
|
||||
$this->assertEquals('bread', $result->name);
|
||||
@ -99,9 +95,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
$result = $this->model->find()->limit(1)->order(array('name' => 1));
|
||||
$id = $result->fetch()->_id;
|
||||
$this->assertEquals(1, $this->model->delete($id));
|
||||
@ -114,9 +108,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testBatchInsert()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
$data = array(
|
||||
array('name' => 'first object'),
|
||||
array('name' => 'second object'),
|
||||
@ -135,9 +127,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDeleteAll()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
|
||||
$this->assertEquals(2, $this->model->count(array('name' => 'eggs')));
|
||||
$this->assertEquals(0, $this->model->deleteAll(array('name' => 'eggs')));
|
||||
@ -150,9 +140,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCount()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
$this->assertEquals(5, $this->model->count());
|
||||
$this->assertEquals(2, $this->model->count(array('name' => 'eggs')));
|
||||
}
|
||||
@ -163,9 +151,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testFetch()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
|
||||
$mock = $this->getMock('CacheKey', array('set', 'get'));
|
||||
$mock->expects($this->exactly(3))
|
||||
@ -204,9 +190,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUseMongoId()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
|
||||
$this->assertAttributeEquals(true, 'useMongoId', $this->model);
|
||||
}
|
||||
@ -217,9 +201,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testId()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
$class = new ReflectionClass('MongoModel');
|
||||
$prop = $class->getProperty('useMongoId');
|
||||
$prop->setAccessible(true);
|
||||
@ -239,9 +221,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testIdToMongoId()
|
||||
{
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
Config::set('DEBUG', 0);
|
||||
|
||||
$this->model->insert(array('name' => 'testbread', 'price' => 3.2, 'quantity' => 10));
|
||||
$this->model->insert(array('name' => 'testbread', 'price' => 12, 'quantity' => 2));
|
||||
|
Reference in New Issue
Block a user