Upgrade to Laravel 13
This commit is contained in:
parent
e8e2bff5e4
commit
9f012b01e4
117 changed files with 1878 additions and 2215 deletions
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Tests\Feature\Admin;
|
||||
|
||||
use App\Models\Note;
|
||||
use App\Models\Place;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
|
@ -55,7 +56,7 @@ class PlacesTest extends TestCase
|
|||
$user = User::factory()->make();
|
||||
$place = Place::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)->get('/admin/places/' . $place->id . '/edit');
|
||||
$response = $this->actingAs($user)->get('/admin/places/'.$place->id.'/edit');
|
||||
$response->assertViewIs('admin.places.edit');
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +68,7 @@ class PlacesTest extends TestCase
|
|||
'name' => 'The Bridgewater Pub',
|
||||
]);
|
||||
|
||||
$this->actingAs($user)->post('/admin/places/' . $place->id, [
|
||||
$this->actingAs($user)->post('/admin/places/'.$place->id, [
|
||||
'_method' => 'PUT',
|
||||
'name' => 'The Bridgewater',
|
||||
'description' => 'Who uses “Pub” anyway',
|
||||
|
|
@ -78,4 +79,62 @@ class PlacesTest extends TestCase
|
|||
'name' => 'The Bridgewater',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function merge_index_page_loads(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
// Use specific coordinates to avoid haversine acos overflow with extreme faker values
|
||||
$place = Place::factory()->create(['latitude' => 53.48, 'longitude' => -2.24]);
|
||||
|
||||
$response = $this->actingAs($user)->get('/admin/places/'.$place->id.'/merge');
|
||||
$response->assertViewIs('admin.places.merge.index');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function merge_edit_page_loads(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
$place1 = Place::factory()->create();
|
||||
$place2 = Place::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)->get('/admin/places/'.$place1->id.'/merge/'.$place2->id);
|
||||
$response->assertViewIs('admin.places.merge.edit');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function merge_store_with_delete_one_moves_notes_and_deletes_place1(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
$place1 = Place::factory()->create();
|
||||
$place2 = Place::factory()->create();
|
||||
$note = Note::factory()->create(['place_id' => $place1->id]);
|
||||
|
||||
$this->actingAs($user)->post('/admin/places/merge', [
|
||||
'place1' => $place1->id,
|
||||
'place2' => $place2->id,
|
||||
'delete' => '1',
|
||||
]);
|
||||
|
||||
$this->assertDatabaseMissing('places', ['id' => $place1->id]);
|
||||
$this->assertDatabaseHas('notes', ['id' => $note->id, 'place_id' => $place2->id]);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function merge_store_with_delete_two_moves_notes_and_deletes_place2(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
$place1 = Place::factory()->create();
|
||||
$place2 = Place::factory()->create();
|
||||
$note = Note::factory()->create(['place_id' => $place2->id]);
|
||||
|
||||
$this->actingAs($user)->post('/admin/places/merge', [
|
||||
'place1' => $place1->id,
|
||||
'place2' => $place2->id,
|
||||
'delete' => '2',
|
||||
]);
|
||||
|
||||
$this->assertDatabaseMissing('places', ['id' => $place2->id]);
|
||||
$this->assertDatabaseHas('notes', ['id' => $note->id, 'place_id' => $place1->id]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue