コード例 #1
0
 public function testSerializableValues()
 {
     $testModel = TestModel::create(['title' => 'Title', 'values' => ['foo' => 'Something', 'bar' => 'Baz']]);
     $this->assertEquals('Something', $testModel->foo, 'Serialized value not properly set.');
     $this->assertEquals('Baz', $testModel->bar, 'Serialized value not properly set.');
     $testModel->foo = 'Bar';
     $this->assertEquals('Bar', $testModel->foo, 'Serialized value not properly set.');
     $testModel->baz = 'bar';
     $this->assertNull($testModel->getValue('baz'), 'Unallowed value was set.');
 }
コード例 #2
0
 public function testGenerateSchema2()
 {
     $model = new TestModel();
     $schema = Pluf::factory('Pluf_DB_Schema', $this->db);
     $schema->model = $model;
     $this->assertEquals(true, $schema->dropTables());
     $this->assertEquals(true, $schema->createTables());
     $model->title = 'my title';
     $model->description = 'A small desc.';
     $this->assertEquals(true, $model->create());
     $this->assertEquals(1, (int) $model->id);
     $this->assertEquals(true, $schema->dropTables());
 }
コード例 #3
0
ファイル: ModelTest.php プロジェクト: abcarroll/DABL
 /**
  * @covers Model::create
  */
 public function testCreate()
 {
     $instance = TestModel::create();
     $this->assertInstanceOf('TestModel', $instance);
 }
コード例 #4
0
ファイル: ModelTest.php プロジェクト: mystlabs/mistydoctrine
 public function testMagicSetter()
 {
     $model = TestModel::create()->setAnotherProperty('value')->setProp1(1);
     $this->assertEquals(1, $model->prop1);
     $this->assertEquals('value', $model->another_property);
 }
コード例 #5
0
ファイル: PlufModelTest.php プロジェクト: burbuja/pluf
 public function testExceptionOnProperty()
 {
     $model = new TestModel();
     $model->title = 'title';
     $model->description = 'A small desc ';
     $this->assertEquals(true, $model->create());
     try {
         $rel = $model->should_fail;
         // next line should not be called
         $this->assertEquals(true, false);
     } catch (Exception $e) {
         $this->assertEquals('Cannot get property "should_fail".', $e->getMessage());
     }
 }