jonnybarnes.uk/tests/Feature/ContactsTest.php

51 lines
1.2 KiB
PHP
Raw Normal View History

2017-02-18 14:16:22 +00:00
<?php
2021-03-17 18:38:18 +00:00
declare(strict_types=1);
2017-02-18 14:16:22 +00:00
namespace Tests\Feature;
use Tests\TestCase;
class ContactsTest extends TestCase
{
/**
2017-02-18 14:31:00 +00:00
* Check the `/contacts` page gives a good response.
2017-02-18 14:16:22 +00:00
*
2021-03-17 18:38:18 +00:00
* @test
2017-02-18 14:16:22 +00:00
*/
2021-03-17 18:38:18 +00:00
public function contactsPageLoadsWithoutError(): void
2017-02-18 14:16:22 +00:00
{
$response = $this->get('/contacts');
$response->assertStatus(200);
}
/**
* Test an individual contact page with default profile image.
*
2021-03-17 18:38:18 +00:00
* @test
2017-02-18 14:16:22 +00:00
*/
2021-03-17 18:38:18 +00:00
public function contactPageShouldFallbackToDefaultProfilePic(): void
2017-02-18 14:16:22 +00:00
{
$response = $this->get('/contacts/tantek');
$response->assertViewHas('image', '/assets/profile-images/default-image');
}
/**
* Test an individual contact page with a specific profile image.
*
2021-03-17 18:38:18 +00:00
* @test
2017-02-18 14:16:22 +00:00
*/
2021-03-17 18:38:18 +00:00
public function contactPageShouldUseSpecificProfilePicIfPresent(): void
2017-02-18 14:16:22 +00:00
{
2017-02-18 15:06:11 +00:00
$response = $this->get('/contacts/aaron');
2017-02-18 14:16:22 +00:00
$response->assertViewHas('image', '/assets/profile-images/aaronparecki.com/image');
}
/** @test */
2021-03-17 18:38:18 +00:00
public function unknownContactReturnsNotFoundResponse(): void
{
$response = $this->get('/contacts/unknown');
$response->assertNotFound();
}
2017-02-18 14:16:22 +00:00
}