/**
  * Test for hasPrimaryKey method with table that has auto increment and the result is false.
  *
  * @return  void
  *
  * @since   12.3
  */
 public function testHasPrimaryKeyAutoincrementFalse()
 {
     TestReflection::setValue($this->object, '_autoincrement', true);
     $this->object->id1 = null;
     $this->object->id2 = null;
     $this->assertFalse($this->object->hasPrimaryKey());
 }
示例#2
0
文件: table.php 项目: 810/redCORE
 /**
  * Validate that the primary key has been set.
  *
  * @return  boolean  True if the primary key(s) have been set.
  *
  * @since   1.5.2
  */
 public function hasPrimaryKey()
 {
     // For Joomla 3.2+ a native method has been provided
     if (method_exists(get_parent_class(), 'hasPrimaryKey')) {
         return parent::hasPrimaryKey();
     }
     // Otherwise, it checks if the only key field compatible for older Joomla versions is set or not
     if (isset($this->_tbl_key) && !empty($this->_tbl_key) && empty($this->{$this->_tbl_key})) {
         return false;
     }
     return true;
 }