Remove some exists checks by not validating

This commit is contained in:
AD7six 2015-01-23 08:29:59 +00:00
parent 51bd1d0a2b
commit 838d23300b
2 changed files with 2 additions and 17 deletions

View file

@ -119,9 +119,9 @@ class DatabaseSession implements CakeSessionHandlerInterface {
$record[$this->_model->primaryKey] = $id; $record[$this->_model->primaryKey] = $id;
try { try {
return $this->_model->save($record); return $this->_model->save($record, array('validate' => false));
} catch (PDOException $e) { } catch (PDOException $e) {
return $this->_model->save($record); return $this->_model->save($record, array('validate' => false));
} }
} }

View file

@ -213,31 +213,16 @@ class DatabaseSessionTest extends CakeTestCase {
->method('exists') ->method('exists')
->will($this->returnValue(false)); ->will($this->returnValue(false));
// First validate
$mockedModel->expects($this->at($counter++))
->method('exists')
->will($this->returnValue(false));
// Second save // Second save
$mockedModel->expects($this->at($counter++)) $mockedModel->expects($this->at($counter++))
->method('exists') ->method('exists')
->will($this->returnValue(false)); ->will($this->returnValue(false));
// Second validate
$mockedModel->expects($this->at($counter++))
->method('exists')
->will($this->returnValue(false));
// Second save retry // Second save retry
$mockedModel->expects($this->at($counter++)) $mockedModel->expects($this->at($counter++))
->method('exists') ->method('exists')
->will($this->returnValue(true)); ->will($this->returnValue(true));
// Second validate retry
$mockedModel->expects($this->at($counter++))
->method('exists')
->will($this->returnValue(false));
// Datasource exists check // Datasource exists check
$mockedModel->expects($this->at($counter++)) $mockedModel->expects($this->at($counter++))
->method('exists') ->method('exists')