Skip to content
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

Speeding up tests #1039

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions tests/Feature/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
use App\Models\Thread;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('requires login', function () {
$this->visit('/admin')
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/ArticleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
use App\Models\Tag;
use App\Notifications\ArticleApprovedNotification;
use App\Notifications\ArticleSubmitted;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Notification;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('users cannot create an article when not logged in', function () {
$this->visit('/articles/create')
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
use Carbon\Carbon;
use Illuminate\Auth\Notifications\VerifyEmail;
use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Notification;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('users can register', function () {
Notification::fake();
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/CanonicalUrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
use App\Models\Article;
use App\Models\Tag;
use App\Models\Thread;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Facades\App;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

function inProduction()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/EditorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
use App\Livewire\Editor;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Sequence;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Livewire\Livewire;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('participants are rendered when mentions are invoked', function () {
$participants = User::factory()->count(3)->create();
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/ForumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
use App\Models\User;
use App\Notifications\MentionNotification;
use App\Notifications\ThreadDeletedNotification;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Support\Facades\Notification;
use Livewire\Livewire;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('users can see a list of latest threads', function () {
Thread::factory()->create(['subject' => 'The first thread']);
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/HomeTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('users can see the homepage', function () {
$this->visit('/')
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/ModeratorTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use App\Models\Thread;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('moderators can edit any thread', function () {
$thread = Thread::factory()->create();
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/NavigationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
use App\Models\Reply;
use App\Models\Thread;
use App\Notifications\NewReplyNotification;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Str;
use Livewire\Livewire;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('a user sees the correct number of notifications', function () {
$userOne = $this->createUser();
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/NotificationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use App\Models\Reply;
use App\Models\Thread;
use App\Notifications\NewReplyNotification;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Str;
use Livewire\Livewire;
Expand All @@ -13,7 +13,7 @@
use function Pest\Laravel\post;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('users_can_see_notifications', function () {
$userOne = $this->createUser();
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/ProfileTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('anyone can see a user profile', function () {
$this->createUser();
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/ReplyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use App\Models\User;
use App\Notifications\MentionNotification;
use App\Rules\InvalidMentionRule;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Support\Facades\Notification;
use Livewire\Livewire;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('users can add a reply to a thread', function () {
$thread = Thread::factory()->create(['subject' => 'The first thread', 'slug' => 'the-first-thread']);
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/SettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

use App\Models\User;
use Database\Factories\UserFactory;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('requires login', function () {
$this->visit('/settings')
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/SubscriptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
use App\Models\Thread;
use App\Models\User;
use App\Notifications\NewReplyNotification;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Str;
use Tests\Feature\BrowserKitTestCase;

uses(BrowserKitTestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);
uses(WithFaker::class);

test('users receive notifications for new replies to threads where they are subscribed to', function () {
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Api/ArticleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
use App\Models\Article;
use Database\Factories\ArticleFactory;
use Database\Factories\TagFactory;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Laravel\Sanctum\Sanctum;
use Tests\CreatesUsers;
use Tests\TestCase;

uses(TestCase::class, CreatesUsers::class, DatabaseMigrations::class);
uses(TestCase::class, CreatesUsers::class, LazilyRefreshDatabase::class);

it('can store an article over the API', function (array $body, array $response) {
Event::fake();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Commands/PostArticleToTwitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
use App\Console\Commands\PostArticleToTwitter;
use App\Models\Article;
use App\Notifications\PostArticleToTwitter as PostArticleToTwitterNotification;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Str;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

beforeEach(function () {
Notification::fake();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Commands/UpdateArticleViewCountsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

use App\Console\Commands\UpdateArticleViewCounts;
use App\Models\Article;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Facades\Http;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('article view counts can be updated', function () {
Http::fake(function () {
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Jobs/BanUserTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use App\Jobs\BanUser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

it('can ban a user', function () {
$user = $this->createUser(['banned_at' => null]);
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Jobs/BlockUserTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use App\Jobs\BlockUser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

it('can block a user', function () {
$blocker = $this->createUser();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Jobs/CreateApiTokenTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

use App\Jobs\CreateApiToken;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

it('creates an API token for the given user', function () {
$user = $this->createUser();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Jobs/CreateArticleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
use App\Events\ArticleWasSubmittedForApproval;
use App\Jobs\CreateArticle;
use App\Models\Article;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Str;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('we can create a draft article', function () {
$user = $this->createUser();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Jobs/CreateReplyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
use App\Jobs\CreateReply;
use App\Models\Reply;
use App\Models\Thread;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Str;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('we can create a reply', function () {
Event::fake();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Jobs/CreateThreadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

use App\Jobs\CreateThread;
use App\Models\Thread;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Str;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('we can create a thread', function () {
$user = $this->createUser();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Jobs/DeleteApiTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

use App\Jobs\DeleteApiToken;
use Database\Factories\UserFactory;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

it('deletes the specified API token for the given user', function () {
$user = $this->createUser();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Jobs/DeleteArticleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

use App\Jobs\DeleteArticle;
use App\Models\Article;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('an article can be deleted', function () {
$article = Article::factory()->create();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Jobs/DeleteRepliesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
use App\Jobs\DeleteReply;
use App\Models\Reply;
use App\Models\Thread;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Tests\TestCase;

uses(TestCase::class);
uses(DatabaseMigrations::class);
uses(LazilyRefreshDatabase::class);

test('reply authors can force delete their replies', function () {
$user = $this->createUser();
Expand Down
Loading
Loading