1
0
mirror of https://github.com/flarum/core.git synced 2025-08-07 08:56:38 +02:00

chore: update dependencies (#4012)

* chore: phpunit 10

* chore: config

* Apply fixes from StyleCI

* chore: phpunit 11 (php 8.2 minimum requirement)

* feat: laravel 11

* Apply fixes from StyleCI

* feat: carbon v3

* fixes
This commit is contained in:
Sami Mazouz
2024-08-06 16:50:09 +01:00
committed by GitHub
parent 2f92a6c739
commit 6b336c5ea8
205 changed files with 1176 additions and 2361 deletions

View File

@@ -4,6 +4,7 @@ composer.phar
.DS_Store
Thumbs.db
tests/.phpunit.cache
tests/.phpunit.result.cache
/tests/integration/tmp
.vagrant

View File

@@ -15,6 +15,7 @@ use Flarum\Post\Post;
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
use Flarum\Testing\integration\TestCase;
use Flarum\User\User;
use PHPUnit\Framework\Attributes\Test;
class UseForumTest extends TestCase
{
@@ -40,7 +41,7 @@ class UseForumTest extends TestCase
]);
}
/** @test */
#[Test]
public function suspended_user_cannot_create_discussions()
{
$response = $this->send(
@@ -61,7 +62,7 @@ class UseForumTest extends TestCase
$this->assertEquals(403, $response->getStatusCode());
}
/** @test */
#[Test]
public function suspended_user_cannot_reply_to_discussions()
{
$response = $this->send(

View File

@@ -14,6 +14,7 @@ use Flarum\Testing\integration\RetrievesAuthorizedUsers;
use Flarum\Testing\integration\TestCase;
use Flarum\User\User;
use Illuminate\Support\Arr;
use PHPUnit\Framework\Attributes\Test;
class ListUsersTest extends TestCase
{
@@ -55,7 +56,7 @@ class ListUsersTest extends TestCase
$this->assertEqualsCanonicalizing([1, 2, 3, 4, 5, 6], Arr::pluck($body['data'], 'id'));
}
/** @test */
#[Test]
public function can_filter_users_by_suspension()
{
$response = $this->send(

View File

@@ -14,6 +14,8 @@ use Flarum\Group\Group;
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
use Flarum\Testing\integration\TestCase;
use Flarum\User\User;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use Psr\Http\Message\ResponseInterface;
class SuspendUserTest extends TestCase
@@ -44,10 +46,8 @@ class SuspendUserTest extends TestCase
]);
}
/**
* @dataProvider allowedToSuspendUser
* @test
*/
#[Test]
#[DataProvider('allowedToSuspendUser')]
public function can_suspend_user_if_allowed(?int $authenticatedAs, int $targetUserId, string $message)
{
$response = $this->sendSuspensionRequest($authenticatedAs, $targetUserId);
@@ -55,10 +55,8 @@ class SuspendUserTest extends TestCase
$this->assertEquals(200, $response->getStatusCode(), $response->getBody()->getContents());
}
/**
* @dataProvider unallowedToSuspendUser
* @test
*/
#[Test]
#[DataProvider('unallowedToSuspendUser')]
public function cannot_suspend_user_if_not_allowed(?int $authenticatedAs, int $targetUserId, string $message)
{
$response = $this->sendSuspensionRequest($authenticatedAs, $targetUserId);
@@ -66,7 +64,7 @@ class SuspendUserTest extends TestCase
$this->assertEquals(403, $response->getStatusCode());
}
public function allowedToSuspendUser(): array
public static function allowedToSuspendUser(): array
{
return [
[1, 2, 'Admin can suspend any user'],
@@ -75,7 +73,7 @@ class SuspendUserTest extends TestCase
];
}
public function unallowedToSuspendUser(): array
public static function unallowedToSuspendUser(): array
{
return [
[1, 1, 'Admin cannot suspend self'],

View File

@@ -1,22 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="true"
stopOnFailure="false"
bootstrap="../../../php-packages/testing/bootstrap/monorepo.php"
>
<coverage processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">../src/</directory>
</include>
</coverage>
</source>
<testsuites>
<testsuite name="Flarum Integration Tests">
<directory suffix="Test.php">./integration</directory>

View File

@@ -1,28 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="../../../php-packages/testing/bootstrap/monorepo.php"
>
<coverage processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">../src/</directory>
</include>
</coverage>
</source>
<testsuites>
<testsuite name="Flarum Unit Tests">
<directory suffix="Test.php">./unit</directory>
</testsuite>
</testsuites>
<listeners>
<listener class="\Mockery\Adapter\Phpunit\TestListener" />
</listeners>
</phpunit>