added it_send_contact_form test

This commit is contained in:
Peter Papp
2021-03-12 16:45:02 +01:00
parent bb2094016b
commit 89a6c51672
5 changed files with 39 additions and 16 deletions

View File

@@ -2,10 +2,15 @@
namespace Tests\Feature\App;
use App\Http\Mail\SendContactMessage;
use App\Models\Setting;
use App\Notifications\SharedSendViaEmail;
use App\Services\SetupService;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Support\Facades\Notification;
use Mail;
use Tests\TestCase;
class AppTest extends TestCase
@@ -30,4 +35,25 @@ class AppTest extends TestCase
$this->get('/')
->assertStatus(200);
}
/**
* @test
*/
public function it_send_contact_form()
{
Mail::fake();
Setting::create([
'name' => 'contact_email',
'value' => 'jane@doe.com',
]);
$this->postJson('/api/contact', [
'email' => 'john@doe.com',
'message' => 'Whaats is up!',
])
->assertStatus(201);
Mail::assertSent( SendContactMessage::class);
}
}