Skip to content

Commit

Permalink
Fix testLinkUsesSingleTransaction to use documented methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Cory Thompson committed Jan 24, 2017
1 parent 4d6ae11 commit 5590853
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/TestCase/ORM/Association/HasManyTest.php
Expand Up @@ -714,12 +714,12 @@ public function testLinkUsesSingleTransaction()

// Ensure that after each model is saved, we are still within a transaction.
$listenerAfterSave = function ($e, $entity, $options) use ($articles) {
$debugInfo = $articles->connection()->__debugInfo();
$transactionLevel = $debugInfo['transactionLevel'];
$this->assertGreaterThan(0, $transactionLevel);
$this->assertTrue($articles->connection()->inTransaction(), 'Multiple transactions used to save associated models.');
};
$articles->eventManager()->on('Model.afterSave', $listenerAfterSave);
$assoc->link($entity, $articles->find('all')->toArray());

$options = ['atomic' => false];
$assoc->link($entity, $articles->find('all')->toArray(), $options);

// Ensure that link was successful.
$new = $this->author->get(2, ['contain' => 'Articles']);
Expand Down

0 comments on commit 5590853

Please sign in to comment.