Skip to content

Commit

Permalink
Merge pull request #6946 from kenjis/fix-4.3-TransactionTest
Browse files Browse the repository at this point in the history
[4.3] test: fix failed TransactionTest
  • Loading branch information
kenjis authored Dec 7, 2022
2 parents d995c54 + b40ddb5 commit 9be490d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 6 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
Expand Down Expand Up @@ -129,6 +130,11 @@

// buggy on union mixed type, new class extends SomeClass marked as object in union, and false replaced with bool in Union
TypedPropertyFromAssignsRector::class,

// rector mistakenly removes `@return true`
RemoveUselessReturnTagRector::class => [
__DIR__ . '/system/Debug/Exceptions.php',
],
]);

// auto import fully qualified class names
Expand Down
2 changes: 0 additions & 2 deletions system/Debug/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,6 @@ private function isDeprecationError(int $error): bool
}

/**
* @noRector \Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector
*
* @return true
*/
private function handleDeprecationError(string $message, ?string $file = null, ?int $line = null): bool
Expand Down
6 changes: 3 additions & 3 deletions tests/system/Database/Live/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace CodeIgniter\Database\Live;

use CodeIgniter\Database\Exceptions\DatabaseException;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\DatabaseTestTrait;
use Config\Database;
use Exception;
use Tests\Support\Database\Seeds\CITestSeeder;

/**
Expand Down Expand Up @@ -78,7 +78,7 @@ public function testTransStartDBDebugTrue()
$builder->insert($jobData);

$this->db->transComplete();
} catch (Exception $e) {
} catch (DatabaseException $e) {
// Do nothing.

// MySQLi
Expand All @@ -99,7 +99,7 @@ public function testTransStartDBDebugTrue()
// ErrorException: oci_execute(): ORA-00001: unique constraint (ORACLE.pk_db_job) violated
}

$this->assertInstanceOf(Exception::class, $e);
$this->assertInstanceOf(DatabaseException::class, $e);
$this->dontSeeInDatabase('job', ['name' => 'Grocery Sales']);
}

Expand Down

0 comments on commit 9be490d

Please sign in to comment.