Skip to content

[8.x] Define the kind of expected exception #39248

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

Merged
merged 1 commit into from
Oct 18, 2021
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
1 change: 1 addition & 0 deletions tests/Database/DatabaseConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ public function testLogQueryFiresEventsIfSet()

public function testBeforeExecutingHooksCanBeRegistered()
{
$this->expectException(Exception::class);
$this->expectExceptionMessage('The callback was fired');

$connection = $this->getMockConnection();
Expand Down
5 changes: 5 additions & 0 deletions tests/Database/DatabaseSchemaBlueprintIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Tests\Database;

use BadMethodCallException;
use Illuminate\Container\Container;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Schema\Blueprint;
Expand Down Expand Up @@ -326,6 +327,7 @@ public function testAddUniqueIndexWithNameWorks()

public function testItEnsuresDroppingMultipleColumnsIsAvailable()
{
$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage("SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification.");

$this->db->connection()->getSchemaBuilder()->table('users', function (Blueprint $table) {
Expand All @@ -336,6 +338,7 @@ public function testItEnsuresDroppingMultipleColumnsIsAvailable()

public function testItEnsuresRenamingMultipleColumnsIsAvailable()
{
$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage("SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification.");

$this->db->connection()->getSchemaBuilder()->table('users', function (Blueprint $table) {
Expand All @@ -346,6 +349,7 @@ public function testItEnsuresRenamingMultipleColumnsIsAvailable()

public function testItEnsuresRenamingAndDroppingMultipleColumnsIsAvailable()
{
$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage("SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification.");

$this->db->connection()->getSchemaBuilder()->table('users', function (Blueprint $table) {
Expand All @@ -356,6 +360,7 @@ public function testItEnsuresRenamingAndDroppingMultipleColumnsIsAvailable()

public function testItEnsuresDroppingForeignKeyIsAvailable()
{
$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage("SQLite doesn't support dropping foreign keys (you would need to re-create the table).");

$this->db->connection()->getSchemaBuilder()->table('users', function (Blueprint $table) {
Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Queue/JobEncryptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Tests\Integration\Queue;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Database\Schema\Blueprint;
Expand Down Expand Up @@ -68,6 +69,7 @@ public function testNonEncryptedJobPayloadIsStoredRaw()
{
Bus::dispatch(new JobEncryptionTestNonEncryptedJob);

$this->expectException(DecryptException::class);
$this->expectExceptionMessage('The payload is invalid');

$this->assertInstanceOf(JobEncryptionTestNonEncryptedJob::class,
Expand Down
1 change: 1 addition & 0 deletions tests/View/Blade/BladeEchoHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function testWhitespaceIsPreservedCorrectly()
*/
public function testHandlerLogicWorksCorrectly($blade)
{
$this->expectException(Exception::class);
$this->expectExceptionMessage('The fluent object has been successfully handled!');

$this->compiler->stringable(Fluent::class, function ($object) {
Expand Down