Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.3] test: fix failed TransactionTest #6946

Merged
merged 2 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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