Skip to content
Permalink
Browse files

Fix testLinkUsesSingleTransaction to use documented methods

  • Loading branch information...
coryjthompson committed Jan 24, 2017
1 parent 4d6ae11 commit 559085361a102aedc7a4d0790752bb9f1d6aa981
Showing with 4 additions and 4 deletions.
  1. +4 −4 tests/TestCase/ORM/Association/HasManyTest.php
@@ -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']);

0 comments on commit 5590853

Please sign in to comment.
You can’t perform that action at this time.