public function testTransactions()
 {
     $transaction = new Transaction(new ModelTransactional());
     $transaction->rollback();
     $available = $transaction->isAvailable();
     $this->assertNotNull($available);
     if ($available) {
         codecept_debug('Transactions Available');
         $this->assertTrue("That transactions are available");
         $canCommitTest = function () {
             $this->canCommitTest();
         };
         $canCommitTest->bindTo($this);
         $this->specify("That transactions can commit", $canCommitTest);
         $canRollbackTest = function () {
             $this->canRollbackTest();
         };
         $canRollbackTest->bindTo($this);
         $this->specify("That transactions can rollback", $canRollbackTest);
     } else {
         codecept_debug('Transactions NOT Available');
         $this->assertTrue(true, "That transactions are not available");
     }
 }
Exemple #2
0
<?php

use Maslosoft\Mangan\Command;
use Maslosoft\Mangan\Mangan;
use Maslosoft\Mangan\Transaction;
use Maslosoft\ManganTest\Models\BaseAttributesAnnotations;
// Here you can initialize variables that will be available to your tests
error_reporting(E_ALL);
echo "Mangan: " . (new Mangan())->getVersion() . PHP_EOL;
echo "MongoDB: " . (new Command())->buildInfo()['version'] . PHP_EOL;
$transactions = 'false';
$t = new Transaction(new BaseAttributesAnnotations());
$t->commit();
if ($t->isAvailable()) {
    $transactions = 'true';
}
echo "Transactions: " . $transactions . PHP_EOL;
ini_set('xdebug.max_nesting_level', 200);