コード例 #1
0
 public function canRollbackTest()
 {
     $model = new ModelTransactional();
     $finder = new Finder($model);
     $tx = new Transaction($model);
     $model->_id = new MongoId();
     $model->title = 'blah';
     $model->save();
     $found = $finder->findByPk($model->_id);
     $this->assertInstanceOf(ModelTransactional::class, $found);
     $tx->rollback();
     $found2 = $finder->findByPk($model->_id);
     $this->assertNull($found2);
 }
コード例 #2
0
ファイル: _bootstrap.php プロジェクト: maslosoft/mangantest
<?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);