1
0
mirror of https://github.com/flarum/core.git synced 2025-08-23 08:33:45 +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

@@ -17,6 +17,8 @@ use Flarum\Post\Post;
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
use Flarum\Testing\integration\TestCase;
use Flarum\User\User;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
class ReplyNotificationTest extends TestCase
{
@@ -62,10 +64,8 @@ class ReplyNotificationTest extends TestCase
]);
}
/**
* @dataProvider replyingSendsNotificationsDataProvider
* @test
*/
#[Test]
#[DataProvider('replyingSendsNotificationsDataProvider')]
public function replying_to_a_discussion_with_comment_post_as_last_post_sends_reply_notification(int $userId, int $discussionId, int $newNotificationCount)
{
$this->app();
@@ -96,7 +96,7 @@ class ReplyNotificationTest extends TestCase
$this->assertEquals($newNotificationCount, $mainUser->getUnreadNotificationCount());
}
public function replyingSendsNotificationsDataProvider(): array
public static function replyingSendsNotificationsDataProvider(): array
{
return [
'admin receives a notification when another replies to a discussion they are following and caught up to' => [1, 1, 1],
@@ -106,7 +106,7 @@ class ReplyNotificationTest extends TestCase
];
}
/** @test */
#[Test]
public function replying_to_a_discussion_with_event_post_as_last_post_sends_reply_notification()
{
$this->app();
@@ -166,10 +166,8 @@ class ReplyNotificationTest extends TestCase
$this->assertEquals(1, $mainUser->getUnreadNotificationCount());
}
/**
* @dataProvider deleteLastPostsProvider
* @test
*/
#[Test]
#[DataProvider('deleteLastPostsProvider')]
public function deleting_last_posts_then_posting_new_one_sends_reply_notification(array $postIds)
{
$this->prepareDatabase([
@@ -222,7 +220,7 @@ class ReplyNotificationTest extends TestCase
$this->assertEquals(1, $mainUser->getUnreadNotificationCount());
}
public function deleteLastPostsProvider(): array
public static function deleteLastPostsProvider(): array
{
return [
[[10, 9, 8]],
@@ -230,7 +228,7 @@ class ReplyNotificationTest extends TestCase
];
}
/** @test */
#[Test]
public function approving_reply_sends_reply_notification()
{
// Flags was only specified because it is required for approval.
@@ -288,7 +286,7 @@ class ReplyNotificationTest extends TestCase
$this->assertEquals(1, $mainUser->getUnreadNotificationCount());
}
/** @test */
#[Test]
public function replying_to_a_discussion_with_a_restricted_post_only_sends_notifications_to_allowed_users()
{
// Add visibility scoper to only allow admin

View File

@@ -15,6 +15,8 @@ use Flarum\Post\Post;
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
use Flarum\Testing\integration\TestCase;
use Flarum\User\User;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
class SubscribeTest extends TestCase
{
@@ -60,10 +62,8 @@ class SubscribeTest extends TestCase
]);
}
/**
* @test
* @dataProvider provideStates
*/
#[Test]
#[DataProvider('provideStates')]
public function can_subscribe_to_a_discussion(int $actorId, int $discussionId, ?string $newState)
{
$this->app();

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>