51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Migrations;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Tests\TestCase;
|
|
|
|
class AssignArrufoEventToPymeRuralClientTest extends TestCase
|
|
{
|
|
public function test_it_assigns_only_the_arrufo_event_to_pyme_rural(): void
|
|
{
|
|
Schema::create('clients', function (Blueprint $table): void {
|
|
$table->id();
|
|
$table->string('code');
|
|
});
|
|
Schema::create('events', function (Blueprint $table): void {
|
|
$table->id();
|
|
$table->foreignId('client_id')->nullable();
|
|
$table->string('tenant_code');
|
|
$table->string('title');
|
|
});
|
|
|
|
DB::table('clients')->insert([
|
|
['id' => 10, 'code' => 'pyme_rural'],
|
|
['id' => 11, 'code' => 'onticket'],
|
|
]);
|
|
DB::table('events')->insert([
|
|
[
|
|
'id' => 20,
|
|
'client_id' => null,
|
|
'tenant_code' => 'onticket',
|
|
'title' => '26.º Fiesta de la Tradición y 4.º Encuentro de Agrupaciones Gauchas',
|
|
],
|
|
[
|
|
'id' => 21,
|
|
'client_id' => 11,
|
|
'tenant_code' => 'onticket',
|
|
'title' => 'Otro evento',
|
|
],
|
|
]);
|
|
|
|
$migration = require database_path('migrations/2026_09_28_000200_assign_arrufo_event_to_pyme_rural_client.php');
|
|
$migration->up();
|
|
|
|
$this->assertDatabaseHas('events', ['id' => 20, 'client_id' => 10]);
|
|
$this->assertDatabaseHas('events', ['id' => 21, 'client_id' => 11]);
|
|
}
|
|
}
|