mirror of
https://github.com/flarum/core.git
synced 2025-08-07 17:07:19 +02:00
test: php 8.4 (#4103)
* test: php 8.4 * fix: php 8.4 deprecations * fix: make argument required * chore: review changes
This commit is contained in:
@@ -210,7 +210,7 @@ class GroupSearchTest extends TestCase
|
||||
$this->assertEqualsCanonicalizing([1, 99, 4, 5, 6], array_column($responseBodyContents['included'], 'id'));
|
||||
}
|
||||
|
||||
private function createRequest(array $group, int $userId = null)
|
||||
private function createRequest(array $group, ?int $userId = null)
|
||||
{
|
||||
$auth = $userId ? ['authenticatedAs' => $userId] : [];
|
||||
|
||||
|
@@ -40,7 +40,7 @@ class PostTestCustomPost extends AbstractEventPost implements MergeableInterface
|
||||
{
|
||||
public static string $type = 'customPost';
|
||||
|
||||
public function saveAfter(Post $previous = null): static
|
||||
public function saveAfter(?Post $previous = null): static
|
||||
{
|
||||
$this->save();
|
||||
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?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="../../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
cacheDirectory=".phpunit.cache"
|
||||
backupStaticProperties="false"
|
||||
displayDetailsOnTestsThatTriggerWarnings="true"
|
||||
failOnPhpunitDeprecation="true"
|
||||
colors="true"
|
||||
processIsolation="true"
|
||||
stopOnFailure="false"
|
||||
|
@@ -1,10 +1,12 @@
|
||||
<?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="../../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
cacheDirectory=".phpunit.cache"
|
||||
backupStaticProperties="false"
|
||||
displayDetailsOnTestsThatTriggerWarnings="true"
|
||||
failOnPhpunitDeprecation="true"
|
||||
colors="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
|
@@ -17,7 +17,7 @@ use PHPUnit\Framework\Attributes\Test;
|
||||
|
||||
class CookieFactoryTest extends TestCase
|
||||
{
|
||||
protected function factory(array $config = null): CookieFactory
|
||||
protected function factory(?array $config = null): CookieFactory
|
||||
{
|
||||
$config = new Config(array_merge([
|
||||
'url' => 'http://flarum.test'
|
||||
|
@@ -11,6 +11,7 @@ namespace Flarum\Tests\unit\Locale;
|
||||
|
||||
use Flarum\Locale\Translator;
|
||||
use Flarum\Testing\unit\TestCase;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Symfony\Component\Translation\Loader\ArrayLoader;
|
||||
use Symfony\Component\Translation\MessageCatalogueInterface;
|
||||
|
||||
@@ -23,7 +24,7 @@ class TranslatorTest extends TestCase
|
||||
* translator works in the same way as JS translator.
|
||||
*/
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function placeholders_encoding()
|
||||
{
|
||||
$translator = new Translator('en');
|
||||
@@ -37,7 +38,7 @@ class TranslatorTest extends TestCase
|
||||
$this->assertSame("test1 test2 ' test2 test1", $translator->trans('test1', ['placeholder' => $translator->trans('test2', ['placeholder' => "'"])]));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function missing_placeholders()
|
||||
{
|
||||
$translator = new Translator('en');
|
||||
@@ -49,7 +50,7 @@ class TranslatorTest extends TestCase
|
||||
$this->assertSame('test1 {placeholder} test1', $translator->trans('test1', []));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function escaped_placeholders()
|
||||
{
|
||||
$translator = new Translator('en');
|
||||
@@ -61,7 +62,7 @@ class TranslatorTest extends TestCase
|
||||
$this->assertSame("test1 ' {placeholder} test1", $translator->trans('test3', ['placeholder' => "'"]));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function plural_rules()
|
||||
{
|
||||
$translator = new Translator('en');
|
||||
@@ -74,7 +75,7 @@ class TranslatorTest extends TestCase
|
||||
$this->assertSame('Page 2 - A & B', $translator->trans('test4', ['forumName' => 'A & B', 'pageNumber' => 2]));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function plural_rules_2()
|
||||
{
|
||||
$translator = new Translator('pl');
|
||||
|
Reference in New Issue
Block a user