Beispiel #1
0
 public function testWorksWithoutMonolog()
 {
     $logger = DatabaseLayer::getInstance()->getLogger();
     DatabaseLayer::getInstance()->setLogger(null);
     TestModel::search()->exec();
     DatabaseLayer::getInstance()->setLogger($logger);
 }
 public function testStoreObject()
 {
     $object = new \StdClass();
     $object->foo = "bar";
     $different_object = new \StdClass();
     $different_object->hello = "there";
     $model = new TestModel();
     $model->date_field = date("Y-m-d H:i:s");
     $model->integer_field = 1;
     $model->text_field = $object;
     $model->save();
     $reload = TestModel::search()->where('test_model_id', $model->test_model_id)->execOne();
     $this->assertEquals(JsonPrettyPrinter::Json($object), $reload->text_field);
     // TODO: This should really be returning a deserialised blob.
     $reload->text_field = $different_object;
     $reload->save();
     $reload_again = TestModel::search()->where('test_model_id', $model->test_model_id)->execOne();
     $this->assertEquals(JsonPrettyPrinter::Json($different_object), $reload_again->text_field);
 }