/**
  * testGetPrimaryKey method
  *
  * @return void
  * @access public
  */
 function testGetPrimaryKey()
 {
     // When param is a model
     $result = $this->db->getPrimaryKey($this->model);
     $this->assertEqual($result, 'id');
     $schema = $this->model->schema();
     unset($schema['id']['key']);
     $this->model->setSchema($schema);
     $result = $this->db->getPrimaryKey($this->model);
     $this->assertNull($result);
     // When param is a table name
     $this->db->simulate = false;
     $this->loadFixtures('Category');
     $result = $this->db->getPrimaryKey('categories');
     $this->assertEqual($result, 'id');
 }
 /**
  * testGetPrimaryKey method
  *
  * @return void
  */
 public function testGetPrimaryKey()
 {
     $schema = $this->model->schema();
     $this->db->describe = $schema;
     $result = $this->db->getPrimaryKey($this->model);
     $this->assertEquals($result, 'id');
     unset($schema['id']['key']);
     $this->db->describe = $schema;
     $result = $this->db->getPrimaryKey($this->model);
     $this->assertNull($result);
 }
Example #3
0
 /**
  * testGetPrimaryKey method
  *
  * @return void
  * @access public
  */
 function testGetPrimaryKey()
 {
     $result = $this->db->getPrimaryKey($this->model);
     $this->assertEqual($result, 'id');
     $schema = $this->model->schema();
     unset($schema['id']['key']);
     $this->model->setSchema($schema);
     $result = $this->db->getPrimaryKey($this->model);
     $this->assertNull($result);
 }