/**
  * testRecordExistsMissingTable method
  *
  * @expectedException PDOException
  * @return void
  */
 public function testRecordExistsMissingTable()
 {
     $TestModel = new TheVoid();
     $TestModel->id = 5;
     $TestModel->exists();
 }
Пример #2
0
 /**
  * Check schema() on a model with useTable = false;
  *
  * @return void
  */
 public function testSchemaUseTableFalse()
 {
     $model = new TheVoid();
     $result = $model->schema();
     $this->assertNull($result);
     $result = $model->create();
     $this->assertEmpty($result);
 }
Пример #3
0
 /**
  * testRecordExists method
  *
  * @access public
  * @return void
  */
 public function testRecordExists()
 {
     $this->loadFixtures('User');
     $TestModel = new User();
     $this->assertFalse($TestModel->exists());
     $TestModel->read(null, 1);
     $this->assertTrue($TestModel->exists());
     $TestModel->create();
     $this->assertFalse($TestModel->exists());
     $TestModel->id = 4;
     $this->assertTrue($TestModel->exists());
     $TestModel = new TheVoid();
     $this->assertFalse($TestModel->exists());
     $TestModel->id = 5;
     $this->expectError();
     ob_start();
     $this->assertFalse($TestModel->exists());
     $output = ob_get_clean();
 }
Пример #4
0
 /**
  * testRecordExists method
  *
  * @return void
  */
 public function testRecordExists()
 {
     $this->loadFixtures('User');
     $TestModel = new User();
     $this->assertFalse($TestModel->exists());
     $TestModel->read(null, 1);
     $this->assertTrue($TestModel->exists());
     $TestModel->create();
     $this->assertFalse($TestModel->exists());
     $TestModel->id = 4;
     $this->assertTrue($TestModel->exists());
     $TestModel = new TheVoid();
     $this->assertFalse($TestModel->exists());
     $TestModel->id = 5;
     $this->assertFalse($TestModel->exists());
 }
 /**
  * test that validates() still performs correctly when useTable = false on the model.
  *
  * @return void
  */
 public function testValidatesWithNoTable()
 {
     $TestModel = new TheVoid();
     $TestModel->validate = array('title' => array('notEmpty' => array('rule' => array('notBlank'), 'required' => true), 'tooShort' => array('rule' => array('minLength', 10))));
     $data = array('TheVoid' => array('title' => 'too short'));
     $TestModel->create($data);
     $result = $TestModel->validates();
     $this->assertFalse($result);
     $data = array('TheVoid' => array('id' => '1', 'title' => 'A good title'));
     $TestModel->create($data);
     $result = $TestModel->validates();
     $this->assertTrue($result);
 }