mirror of
https://github.com/flarum/core.git
synced 2025-08-20 07:11:31 +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:
@@ -64,7 +64,7 @@ trait InteractsWithUnapprovedContent
|
||||
/**
|
||||
* null: Guest, 2: Normal User.
|
||||
*/
|
||||
public function unallowedUsers(): array
|
||||
public static function unallowedUsers(): array
|
||||
{
|
||||
return [[null], [2]];
|
||||
}
|
||||
@@ -72,7 +72,7 @@ trait InteractsWithUnapprovedContent
|
||||
/**
|
||||
* 1: Admin, 3: Permission Given, 4: Discussions Author.
|
||||
*/
|
||||
public function allowedUsers(): array
|
||||
public static function allowedUsers(): array
|
||||
{
|
||||
return [[1], [3], [4]];
|
||||
}
|
||||
|
@@ -17,6 +17,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 ApprovePostsTest extends TestCase
|
||||
{
|
||||
@@ -59,9 +60,7 @@ class ApprovePostsTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function can_approve_unapproved_post()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -81,9 +80,7 @@ class ApprovePostsTest extends TestCase
|
||||
$this->assertEquals(1, $this->database()->table('posts')->where('id', 3)->where('is_approved', 1)->count());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function cannot_approve_post_without_permission()
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -103,9 +100,7 @@ class ApprovePostsTest extends TestCase
|
||||
$this->assertEquals(0, $this->database()->table('posts')->where('id', 3)->where('is_approved', 1)->count());
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
public function hiding_post_silently_approves_it()
|
||||
{
|
||||
$response = $this->send(
|
||||
|
@@ -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 CreatePostsTest extends TestCase
|
||||
{
|
||||
@@ -68,10 +70,8 @@ class CreatePostsTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider startDiscussionDataProvider
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
#[DataProvider('startDiscussionDataProvider')]
|
||||
public function can_start_discussion_without_approval_when_allowed(int $authenticatedAs, bool $allowed)
|
||||
{
|
||||
$this->database()->table('group_permission')->where('group_id', Group::MEMBER_ID)->where('permission', 'discussion.startWithoutApproval')->delete();
|
||||
@@ -98,10 +98,8 @@ class CreatePostsTest extends TestCase
|
||||
$this->assertEquals($allowed ? 1 : 0, $this->database()->table('discussions')->where('id', $json['data']['id'])->value('is_approved'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider replyToDiscussionDataProvider
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
#[DataProvider('replyToDiscussionDataProvider')]
|
||||
public function can_reply_without_approval_when_allowed(?int $authenticatedAs, bool $allowed)
|
||||
{
|
||||
$this->database()->table('group_permission')->where('group_id', Group::MEMBER_ID)->where('permission', 'discussion.replyWithoutApproval')->delete();
|
||||
|
@@ -13,6 +13,8 @@ use Flarum\Approval\Tests\integration\InteractsWithUnapprovedContent;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Illuminate\Support\Arr;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
|
||||
class ListDiscussionsTest extends TestCase
|
||||
{
|
||||
@@ -28,10 +30,8 @@ class ListDiscussionsTest extends TestCase
|
||||
$this->prepareUnapprovedDatabaseContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider unallowedUsers
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
#[DataProvider('unallowedUsers')]
|
||||
public function can_only_see_approved_if_not_allowed_to_approve(?int $authenticatedAs)
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -44,10 +44,8 @@ class ListDiscussionsTest extends TestCase
|
||||
$this->assertEqualsCanonicalizing([1, 4, 5, 7], Arr::pluck($body['data'], 'id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider allowedUsers
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
#[DataProvider('allowedUsers')]
|
||||
public function can_see_unapproved_if_allowed_to_approve(int $authenticatedAs)
|
||||
{
|
||||
$response = $this->send(
|
||||
|
@@ -13,6 +13,8 @@ use Flarum\Approval\Tests\integration\InteractsWithUnapprovedContent;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Illuminate\Support\Arr;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
|
||||
class ListPostsTest extends TestCase
|
||||
{
|
||||
@@ -28,10 +30,8 @@ class ListPostsTest extends TestCase
|
||||
$this->prepareUnapprovedDatabaseContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider unallowedUsers
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
#[DataProvider('unallowedUsers')]
|
||||
public function can_only_see_approved_if_not_allowed_to_approve(?int $authenticatedAs)
|
||||
{
|
||||
$response = $this->send(
|
||||
@@ -50,10 +50,8 @@ class ListPostsTest extends TestCase
|
||||
$this->assertEqualsCanonicalizing([7, 8, 10], Arr::pluck($body['data'], 'id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider allowedUsers
|
||||
* @test
|
||||
*/
|
||||
#[Test]
|
||||
#[DataProvider('allowedUsers')]
|
||||
public function can_see_unapproved_if_allowed_to_approve(int $authenticatedAs)
|
||||
{
|
||||
$response = $this->send(
|
||||
|
Reference in New Issue
Block a user