Add type hints for Laravel 10

This commit is contained in:
Shift
2023-05-24 21:33:15 +00:00
parent 4124cf39db
commit 979b9f704c
67 changed files with 118 additions and 114 deletions

View File

@@ -20,7 +20,7 @@ class ArticlesApiTest extends TestCase
$this->faker = FakerFactory::create();
}
public function testAnyUserCanViewArticle()
public function testAnyUserCanViewArticle(): void
{
// Create an event
$article = Article::factory()->create([
@@ -51,7 +51,7 @@ class ArticlesApiTest extends TestCase
]);
}
public function testAdminCanCreateUpdateDeleteArticle()
public function testAdminCanCreateUpdateDeleteArticle(): void
{
// Create a user with the admin/events permission
$adminUser = User::factory()->create();
@@ -102,7 +102,7 @@ class ArticlesApiTest extends TestCase
]);
}
public function testNonAdminCannotCreateUpdateDeleteArticle()
public function testNonAdminCannotCreateUpdateDeleteArticle(): void
{
// Create a user without admin/events permission
$user = User::factory()->create();

View File

@@ -9,7 +9,7 @@ class AuthApiTest extends TestCase
use RefreshDatabase;
public function testLogin()
public function testLogin(): void
{
$user = User::factory()->create([
'password' => bcrypt('password'),

View File

@@ -8,7 +8,7 @@ class ContactFormTest extends TestCase
use RefreshDatabase;
public function testContactForm()
public function testContactForm(): void
{
$formData = [
'name' => 'John Doe',

View File

@@ -21,7 +21,7 @@ class EventsApiTest extends TestCase
$this->faker = FakerFactory::create();
}
public function testAnyUserCanViewEvent()
public function testAnyUserCanViewEvent(): void
{
// Create an event
$event = Event::factory()->create([
@@ -52,7 +52,7 @@ class EventsApiTest extends TestCase
]);
}
public function testAnyUserCannotSeeDraftEvent()
public function testAnyUserCannotSeeDraftEvent(): void
{
// Create a draft event
$draftEvent = Event::factory()->create([
@@ -85,7 +85,7 @@ class EventsApiTest extends TestCase
]);
}
public function testAdminCanCreateUpdateDeleteEvent()
public function testAdminCanCreateUpdateDeleteEvent(): void
{
// Create a user with the admin/events permission
$adminUser = User::factory()->create();
@@ -139,7 +139,7 @@ class EventsApiTest extends TestCase
]);
}
public function testNonAdminCannotCreateUpdateDeleteEvent()
public function testNonAdminCannotCreateUpdateDeleteEvent(): void
{
// Create a user without admin/events permission
$user = User::factory()->create();

View File

@@ -10,7 +10,7 @@ class UsersApiTest extends TestCase
use RefreshDatabase;
public function testNonAdminUsersCanOnlyViewBasicUserInfo()
public function testNonAdminUsersCanOnlyViewBasicUserInfo(): void
{
// create a non-admin user
$nonAdminUser = User::factory()->create();
@@ -71,7 +71,7 @@ class UsersApiTest extends TestCase
]);
}
public function testGuestCannotCreateUser()
public function testGuestCannotCreateUser(): void
{
$userData = [
'email' => 'johndoe@example.com',
@@ -85,7 +85,7 @@ class UsersApiTest extends TestCase
]);
}
public function testGuestCanRegisterUser()
public function testGuestCanRegisterUser(): void
{
$userData = [
'first_name' => 'John',
@@ -102,7 +102,7 @@ class UsersApiTest extends TestCase
]);
}
public function testCannotCreateDuplicateEmailOrDisplayName()
public function testCannotCreateDuplicateEmailOrDisplayName(): void
{
$userData = [
'display_name' => 'JackDoe',
@@ -125,7 +125,7 @@ class UsersApiTest extends TestCase
$response->assertJsonValidationErrors(['display_name', 'email']);
}
public function testUserCanOnlyUpdateOwnUser()
public function testUserCanOnlyUpdateOwnUser(): void
{
$user = User::factory()->create();
@@ -153,7 +153,7 @@ class UsersApiTest extends TestCase
$response->assertStatus(403);
}
public function testUserCannotDeleteUsers()
public function testUserCannotDeleteUsers(): void
{
$user = User::factory()->create();
@@ -169,7 +169,7 @@ class UsersApiTest extends TestCase
$this->assertDatabaseHas('users', ['id' => $otherUser->id]);
}
public function testAdminCanUpdateAnyUser()
public function testAdminCanUpdateAnyUser(): void
{
$admin = User::factory()->create();
$admin->givePermission('admin/users');
@@ -204,7 +204,7 @@ class UsersApiTest extends TestCase
]);
}
public function testAdminCanDeleteAnyUser()
public function testAdminCanDeleteAnyUser(): void
{
$admin = User::factory()->create();
$admin->givePermission('admin/users');

View File

@@ -11,7 +11,7 @@ class ExampleTest extends TestCase
*
* @return void
*/
public function test_that_true_is_true()
public function test_that_true_is_true(): void
{
$this->assertTrue(true);
}