Skip to content

Commit

Permalink
Fix tests Oracle, add expectNotToPerformAssertions() in `testTransa…
Browse files Browse the repository at this point in the history
…ctionIsolation()`.
  • Loading branch information
terabytesoftw committed Sep 20, 2023
1 parent 6cdef80 commit 995740b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
5 changes: 3 additions & 2 deletions tests/framework/db/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@ public function testTransactionIsolation()
$transaction->commit();

$transaction = $connection->beginTransaction(Transaction::SERIALIZABLE);
$transaction->commit();

$this->assertTrue(true); // should not be any exception so far
$this->expectNotToPerformAssertions();

$transaction->commit();
}

public function testTransactionShortcutException()
Expand Down
6 changes: 3 additions & 3 deletions tests/framework/db/oci/ActiveRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ class ActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest

public function testCastValues()
{
// pass, because boolean casting is not available
return;
$model = new Type();

$model->int_col = 123;
$model->int_col2 = 456;
$model->smallint_col = 42;
Expand All @@ -42,13 +41,14 @@ public function testCastValues()

/* @var $model Type */
$model = Type::find()->one();

$this->assertSame(123, $model->int_col);
$this->assertSame(456, $model->int_col2);
$this->assertSame(42, $model->smallint_col);
$this->assertSame('1337', trim($model->char_col));
$this->assertSame('test', $model->char_col2);
$this->assertSame('test123', $model->char_col3);
$this->assertSame(1337.42, $model->float_col);
$this->assertSame(3.742, $model->float_col);
$this->assertSame(42.1337, $model->float_col2);
$this->assertEquals('1', $model->bool_col);
$this->assertEquals('0', $model->bool_col2);
Expand Down
3 changes: 3 additions & 0 deletions tests/framework/db/oci/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public function testTransactionIsolation()
$transaction->commit();

$transaction = $connection->beginTransaction(Transaction::SERIALIZABLE);

$this->expectNotToPerformAssertions();

$transaction->commit();
}

Expand Down
5 changes: 3 additions & 2 deletions tests/framework/db/pgsql/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ public function testTransactionIsolation()

$transaction = $connection->beginTransaction();
$transaction->setIsolationLevel(Transaction::SERIALIZABLE . ' READ ONLY DEFERRABLE');
$transaction->commit();

$this->assertTrue(true); // No error occurred – assert passed.
$this->expectNotToPerformAssertions();

$transaction->commit();
}
}
5 changes: 3 additions & 2 deletions tests/framework/db/sqlite/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ public function testTransactionIsolation()
$transaction->rollBack();

$transaction = $connection->beginTransaction(Transaction::SERIALIZABLE);
$transaction->rollBack();

$this->assertTrue(true); // No exceptions means test is passed.
$this->expectNotToPerformAssertions();

$transaction->rollBack();
}

public function testMasterSlave()
Expand Down

0 comments on commit 995740b

Please sign in to comment.