Skip to content

Commit

Permalink
Fixing tests and CS errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jul 17, 2016
1 parent 3be1067 commit eff2902
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions tests/TestCase/ORM/TableRegressionTest.php
Expand Up @@ -52,15 +52,18 @@ public function tearDown()
* in the afterSave callback
*
* @see https://github.com/cakephp/cakephp/issues/9079
* @expectedException \Cake\ORM\RolledbackTransactionException
* @expectedException Cake\ORM\Exception\RolledbackTransactionException
* @return void
*/
public function testAfterSaveRollbackTransaction()
{
$table = TableRegistry::get('Authors');
$table->eventManager()->on('Model.afterSave', function () use ($table) {
$table->connection()->rollback();
});
$table->eventManager()->on(
'Model.afterSave',
function () use ($table) {
$table->connection()->rollback();
}
);
$entity = $table->newEntity(['name' => 'Jon']);
$table->save($entity);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/TestCase/ORM/TableTest.php
Expand Up @@ -2427,7 +2427,7 @@ public function testAtomicSave()
$config = ConnectionManager::config('test');

$connection = $this->getMockBuilder('\Cake\Database\Connection')
->setMethods(['begin', 'commit'])
->setMethods(['begin', 'commit', 'inTransaction'])
->setConstructorArgs([$config])
->getMock();
$connection->driver($this->connection->driver());
Expand All @@ -2441,6 +2441,7 @@ public function testAtomicSave()

$connection->expects($this->once())->method('begin');
$connection->expects($this->once())->method('commit');
$connection->expects($this->any())->method('inTransaction')->will($this->returnValue(true));
$data = new \Cake\ORM\Entity([
'username' => 'superuser',
'created' => new Time('2013-10-10 00:00'),
Expand Down

0 comments on commit eff2902

Please sign in to comment.