/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Integration/Database/EloquentCollectionFreshTest.php
37 строк
1021 B
Mior Muhammad Zaki
[10.x] Streamline `DatabaseMigrations` and `RefreshDatabase` events (#49153)
28 ноя 2023, 18:22
Не верифицирован
28 ноя 2023, 18:22
1e03a4a
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Integration\Database; use Illuminate\Database\Eloquent\Collection as EloquentCollection; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; use Illuminate\Tests\Integration\Database\Fixtures\User; class EloquentCollectionFreshTest extends DatabaseTestCase { protected function afterRefreshingDatabase() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('email'); $table->timestamps(); }); } public function testEloquentCollectionFresh() { User::insert([ ['email' => 'laravel@framework.com'], ['email' => 'laravel@laravel.com'], ]); $collection = User::all(); $collection->first()->delete(); $freshCollection = $collection->fresh(); $this->assertCount(1, $freshCollection); $this->assertInstanceOf(EloquentCollection::class, $freshCollection); } }