mirror of
https://github.com/linuxserver/Heimdall.git
synced 2026-02-21 12:10:34 +09:00
Add type hints for Laravel 10
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Contracts\Console\Kernel;
|
||||
|
||||
trait CreatesApplication
|
||||
@@ -11,7 +12,7 @@ trait CreatesApplication
|
||||
*
|
||||
* @return \Illuminate\Foundation\Application
|
||||
*/
|
||||
public function createApplication()
|
||||
public function createApplication(): Application
|
||||
{
|
||||
$app = require __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class DashTest extends TestCase
|
||||
* Test Cases
|
||||
*/
|
||||
|
||||
public function test_loads_empty_dash()
|
||||
public function test_loads_empty_dash(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
@@ -51,7 +51,7 @@ class DashTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function test_displays_items_on_the_dash()
|
||||
public function test_displays_items_on_the_dash(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
@@ -67,7 +67,7 @@ class DashTest extends TestCase
|
||||
$response->assertSee('Item 3');
|
||||
}
|
||||
|
||||
public function test_displays_tags_on_the_dash()
|
||||
public function test_displays_tags_on_the_dash(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class ItemCreateTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_displays_the_item_create_page()
|
||||
public function test_displays_the_item_create_page(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
@@ -18,7 +18,7 @@ class ItemCreateTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function test_display_the_home_dashboard_tag()
|
||||
public function test_display_the_home_dashboard_tag(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
@@ -27,7 +27,7 @@ class ItemCreateTest extends TestCase
|
||||
$response->assertSee('Home dashboard');
|
||||
}
|
||||
|
||||
public function test_creates_a_new_item()
|
||||
public function test_creates_a_new_item(): void
|
||||
{
|
||||
$this->seed();
|
||||
$item = [
|
||||
@@ -46,7 +46,7 @@ class ItemCreateTest extends TestCase
|
||||
$response->assertSee('Redirecting to');
|
||||
}
|
||||
|
||||
public function test_redirects_to_dash_when_adding_a_new_item()
|
||||
public function test_redirects_to_dash_when_adding_a_new_item(): void
|
||||
{
|
||||
$this->seed();
|
||||
$item = [
|
||||
|
||||
@@ -10,7 +10,7 @@ class ItemDeleteTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_deletes_an_item()
|
||||
public function test_deletes_an_item(): void
|
||||
{
|
||||
$this->seed();
|
||||
$item = Item::factory()
|
||||
@@ -23,7 +23,7 @@ class ItemDeleteTest extends TestCase
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
|
||||
public function test_redirects_to_item_list_page_when_deleting_an_item()
|
||||
public function test_redirects_to_item_list_page_when_deleting_an_item(): void
|
||||
{
|
||||
$this->seed();
|
||||
$item = Item::factory()
|
||||
|
||||
@@ -12,14 +12,14 @@ class ItemExportTest extends TestCase
|
||||
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_returns_empty_jsonarray_when_there_are_no_items_in_the_db()
|
||||
public function test_returns_empty_jsonarray_when_there_are_no_items_in_the_db(): void
|
||||
{
|
||||
$response = $this->get('api/item');
|
||||
|
||||
$response->assertJsonCount(0);
|
||||
}
|
||||
|
||||
public function test_returns_exactly_the_defined_fields()
|
||||
public function test_returns_exactly_the_defined_fields(): void
|
||||
{
|
||||
$exampleItem = [
|
||||
"appdescription" => "Description",
|
||||
@@ -37,7 +37,7 @@ class ItemExportTest extends TestCase
|
||||
$response->assertExactJson([(object)$exampleItem]);
|
||||
}
|
||||
|
||||
public function test_returns_all_items()
|
||||
public function test_returns_all_items(): void
|
||||
{
|
||||
Item::factory()
|
||||
->count(3)
|
||||
@@ -48,7 +48,7 @@ class ItemExportTest extends TestCase
|
||||
$response->assertJsonCount(3);
|
||||
}
|
||||
|
||||
public function test_does_not_return_deleted_item()
|
||||
public function test_does_not_return_deleted_item(): void
|
||||
{
|
||||
Item::factory()
|
||||
->create([
|
||||
@@ -62,7 +62,7 @@ class ItemExportTest extends TestCase
|
||||
$response->assertJsonCount(1);
|
||||
}
|
||||
|
||||
public function test_does_not_return_tags()
|
||||
public function test_does_not_return_tags(): void
|
||||
{
|
||||
Item::factory()
|
||||
->create([
|
||||
|
||||
@@ -18,7 +18,7 @@ class ItemListTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_displays_items_on_the_item_list_page()
|
||||
public function test_displays_items_on_the_item_list_page(): void
|
||||
{
|
||||
$this->addItemWithTitleToDB('Item 1');
|
||||
$this->addItemWithTitleToDB('Item 2');
|
||||
@@ -32,7 +32,7 @@ class ItemListTest extends TestCase
|
||||
$response->assertSee('Item 3');
|
||||
}
|
||||
|
||||
public function test_escapes_xss_on_the_item_list_page()
|
||||
public function test_escapes_xss_on_the_item_list_page(): void
|
||||
{
|
||||
$this->addItemWithTitleToDB('<script>alert("XSS")</script>');
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class SettingsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_displays_the_settings_page()
|
||||
public function test_displays_the_settings_page(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class TagListTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_displays_the_tags_on_the_tag_list_page()
|
||||
public function test_displays_the_tags_on_the_tag_list_page(): void
|
||||
{
|
||||
$this->addTagWithTitleToDB('Tag 1');
|
||||
$this->addTagWithTitleToDB('Tag 2');
|
||||
@@ -33,7 +33,7 @@ class TagListTest extends TestCase
|
||||
$response->assertSee('Tag 3');
|
||||
}
|
||||
|
||||
public function test_escapes_xss_on_the_tag_list_page()
|
||||
public function test_escapes_xss_on_the_tag_list_page(): void
|
||||
{
|
||||
$this->addTagWithTitleToDB('<script>alert("XSS")</script>');
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class UserListTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_displays_admin_on_user_list_page_when_default_install()
|
||||
public function test_displays_admin_on_user_list_page_when_default_install(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
@@ -28,7 +28,7 @@ class UserListTest extends TestCase
|
||||
$response->assertSee('admin');
|
||||
}
|
||||
|
||||
public function test_displays_users_on_user_list_page()
|
||||
public function test_displays_users_on_user_list_page(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class SettingsSeederTest extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_returns_a_jsonmap_with_same_amount_of_items_as_language_directories_present()
|
||||
public function test_returns_a_jsonmap_with_same_amount_of_items_as_language_directories_present(): void
|
||||
{
|
||||
$languageDirectories = array_filter(glob(resource_path().'/lang/*'), 'is_dir');
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class IsImageTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function test_returns_true_when_file_is_image()
|
||||
public function test_returns_true_when_file_is_image(): void
|
||||
{
|
||||
$file = file_get_contents(__DIR__ . '/fixtures/heimdall-icon-small.png');
|
||||
|
||||
@@ -21,7 +21,7 @@ class IsImageTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function test_returns_false_when_file_extension_is_image_but_content_is_not()
|
||||
public function test_returns_false_when_file_extension_is_image_but_content_is_not(): void
|
||||
{
|
||||
$actual = isImage("<?php ?>", "png");
|
||||
|
||||
@@ -31,7 +31,7 @@ class IsImageTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function test_returns_false_when_file_extension_is_not_image_but_content_is()
|
||||
public function test_returns_false_when_file_extension_is_not_image_but_content_is(): void
|
||||
{
|
||||
$file = file_get_contents(__DIR__ . '/fixtures/heimdall-icon-small.png');
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class SlugTest extends TestCase
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function test_slug_returns_valid_tag_for_cn_characters_when_language_is_set_to_en_US()
|
||||
public function test_slug_returns_valid_tag_for_cn_characters_when_language_is_set_to_en_US(): void
|
||||
{
|
||||
$tag = str_slug('中文測試', '-', 'en_US');
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class LangTest extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_all_language_keys_are_defined()
|
||||
public function test_all_language_keys_are_defined(): void
|
||||
{
|
||||
$this->markTestSkipped('2022-11-14 Lot of keys missing. Enable this test to see them all.');
|
||||
$languageDirectories = array_filter(glob(resource_path().'/lang/*'), 'is_dir');
|
||||
|
||||
Reference in New Issue
Block a user