Skip to content

Commit

Permalink
[slim-skeleton-11.x] Test Improvements (#49111)
Browse files Browse the repository at this point in the history
* Test Improvements

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* Fix MariaDB Tests with changed query

* Fix Testbench version

* Allow to override collation using DB_COLLATION

Signed-off-by: Mior Muhammad Zaki <[email protected]>

* wip

Signed-off-by: Mior Muhammad Zaki <[email protected]>

---------

Signed-off-by: Mior Muhammad Zaki <[email protected]>
Co-authored-by: Julius Kiekbusch <[email protected]>
  • Loading branch information
2 people authored and taylorotwell committed Nov 28, 2023
1 parent 6fde4a4 commit fbe8368
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
env:
DB_CONNECTION: mysql
DB_USERNAME: root
MYSQL_COLLATION: utf8mb4_unicode_ci

mysql_8:
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"league/flysystem-sftp-v3": "^3.0",
"mockery/mockery": "^1.5.1",
"nyholm/psr7": "^1.2",
"orchestra/testbench-core": "^9.0",
"orchestra/testbench-core": "dev-next/slim-skeleton",
"pda/pheanstalk": "^4.0",
"phpstan/phpstan": "^1.4.7",
"phpunit/phpunit": "^10.1",
Expand Down
7 changes: 4 additions & 3 deletions tests/Integration/Database/SchemaBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ public function testChangeTextColumnToTextColumn()

$uppercase = strtoupper($type);

$expected = ["ALTER TABLE test CHANGE test_column test_column $uppercase NOT NULL"];

$this->assertEquals($expected, $queries);
$this->assertContains($queries, [
["ALTER TABLE test CHANGE test_column test_column $uppercase NOT NULL"], // MySQL
["ALTER TABLE test CHANGE test_column test_column $uppercase NOT NULL COLLATE `utf8mb4_uca1400_ai_ci`"], // MariaDB
]);
}
}

Expand Down
4 changes: 3 additions & 1 deletion tests/Integration/Generators/CacheTableCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace Illuminate\Tests\Integration\Generators;

use Illuminate\Cache\Console\CacheTableCommand;

class CacheTableCommandTest extends TestCase
{
public function testCreateMakesMigration()
{
$this->artisan('cache:table')->assertExitCode(0);
$this->artisan(CacheTableCommand::class)->assertExitCode(0);

$this->assertMigrationFileContains([
'use Illuminate\Database\Migrations\Migration;',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace Illuminate\Tests\Integration\Generators;

use Illuminate\Notifications\Console\NotificationTableCommand;

class NotificationTableCommandTest extends TestCase
{
public function testCreateMakesMigration()
{
$this->artisan('notifications:table')->assertExitCode(0);
$this->artisan(NotificationTableCommand::class)->assertExitCode(0);

$this->assertMigrationFileContains([
'use Illuminate\Database\Migrations\Migration;',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace Illuminate\Tests\Integration\Generators;

use Illuminate\Queue\Console\BatchesTableCommand;

class QueueBatchesTableCommandTest extends TestCase
{
public function testCreateMakesMigration()
{
$this->artisan('queue:batches-table')->assertExitCode(0);
$this->artisan(BatchesTableCommand::class)->assertExitCode(0);

$this->assertMigrationFileContains([
'use Illuminate\Database\Migrations\Migration;',
Expand Down
4 changes: 3 additions & 1 deletion tests/Integration/Generators/QueueFailedTableCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace Illuminate\Tests\Integration\Generators;

use Illuminate\Queue\Console\FailedTableCommand;

class QueueFailedTableCommandTest extends TestCase
{
public function testCreateMakesMigration()
{
$this->artisan('queue:failed-table')->assertExitCode(0);
$this->artisan(FailedTableCommand::class)->assertExitCode(0);

$this->assertMigrationFileContains([
'use Illuminate\Database\Migrations\Migration;',
Expand Down
4 changes: 3 additions & 1 deletion tests/Integration/Generators/QueueTableCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace Illuminate\Tests\Integration\Generators;

use Illuminate\Queue\Console\TableCommand;

class QueueTableCommandTest extends TestCase
{
public function testCreateMakesMigration()
{
$this->artisan('queue:table')->assertExitCode(0);
$this->artisan(TableCommand::class)->assertExitCode(0);

$this->assertMigrationFileContains([
'use Illuminate\Database\Migrations\Migration;',
Expand Down
4 changes: 3 additions & 1 deletion tests/Integration/Generators/SessionTableCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace Illuminate\Tests\Integration\Generators;

use Illuminate\Session\Console\SessionTableCommand;

class SessionTableCommandTest extends TestCase
{
public function testCreateMakesMigration()
{
$this->artisan('session:table')->assertExitCode(0);
$this->artisan(SessionTableCommand::class)->assertExitCode(0);

$this->assertMigrationFileContains([
'use Illuminate\Database\Migrations\Migration;',
Expand Down

0 comments on commit fbe8368

Please sign in to comment.