]> BookStack Code Mirror - bookstack/commitdiff
Testing: Addressed deprecation in test helper
authorDan Brown <redacted>
Mon, 25 Aug 2025 14:01:13 +0000 (15:01 +0100)
committerDan Brown <redacted>
Mon, 25 Aug 2025 14:01:13 +0000 (15:01 +0100)
Also updated version in phpunit config

phpunit.xml
tests/Helpers/EntityProvider.php

index 243c3d3bc84bca8cfa5bf631023d95991e75c066..a8e725d4106596bdae83bf48757b02a83a580ec9 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
          bootstrap="vendor/autoload.php"
          displayDetailsOnTestsThatTriggerDeprecations="true"
          colors="true">
index 22e554f74b5caa08ec049d3668afeca0780fb313..c794f9478ab317cef7130efe3787ffcde4ece3a7 100644 (file)
@@ -6,7 +6,6 @@ use BookStack\Entities\Models\Book;
 use BookStack\Entities\Models\Bookshelf;
 use BookStack\Entities\Models\Chapter;
 use BookStack\Entities\Models\Entity;
-use BookStack\Entities\Models\HasCoverImage;
 use BookStack\Entities\Models\Page;
 use BookStack\Entities\Repos\BookRepo;
 use BookStack\Entities\Repos\BookshelfRepo;
@@ -34,9 +33,9 @@ class EntityProvider
     ];
 
     /**
-     * Get an un-fetched page from the system.
+     * Get an unfetched page from the system.
      */
-    public function page(callable $queryFilter = null): Page
+    public function page(callable|null $queryFilter = null): Page
     {
         /** @var Page $page */
         $page = Page::query()->when($queryFilter, $queryFilter)->whereNotIn('id', $this->fetchCache['page'])->first();
@@ -64,9 +63,9 @@ class EntityProvider
     }
 
     /**
-     * Get an un-fetched chapter from the system.
+     * Get an unfetched chapter from the system.
      */
-    public function chapter(callable $queryFilter = null): Chapter
+    public function chapter(callable|null $queryFilter = null): Chapter
     {
         /** @var Chapter $chapter */
         $chapter = Chapter::query()->when($queryFilter, $queryFilter)->whereNotIn('id', $this->fetchCache['chapter'])->first();
@@ -80,9 +79,9 @@ class EntityProvider
     }
 
     /**
-     * Get an un-fetched book from the system.
+     * Get an unfetched book from the system.
      */
-    public function book(callable $queryFilter = null): Book
+    public function book(callable|null $queryFilter = null): Book
     {
         /** @var Book $book */
         $book = Book::query()->when($queryFilter, $queryFilter)->whereNotIn('id', $this->fetchCache['book'])->first();
@@ -101,9 +100,9 @@ class EntityProvider
     }
 
     /**
-     * Get an un-fetched shelf from the system.
+     * Get an unfetched shelf from the system.
      */
-    public function shelf(callable $queryFilter = null): Bookshelf
+    public function shelf(callable|null $queryFilter = null): Bookshelf
     {
         /** @var Bookshelf $shelf */
         $shelf = Bookshelf::query()->when($queryFilter, $queryFilter)->whereNotIn('id', $this->fetchCache['bookshelf'])->first();