mirror of
https://github.com/flarum/core.git
synced 2025-08-06 16:36:47 +02:00
Convert more helpers in tests
This commit is contained in:
@@ -60,7 +60,7 @@ class CreateDiscussionControllerTest extends ApiControllerTestCase
|
||||
$data = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertEquals($this->data['title'], $discussion->title);
|
||||
$this->assertEquals($this->data['title'], array_get($data, 'data.attributes.title'));
|
||||
$this->assertEquals($this->data['title'], Arr::get($data, 'data.attributes.title'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -14,6 +14,7 @@ namespace Flarum\Tests\integration\api\Controller;
|
||||
use Flarum\Api\Controller\CreateGroupController;
|
||||
use Flarum\Group\Group;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CreateGroupControllerTest extends ApiControllerTestCase
|
||||
@@ -72,7 +73,7 @@ class CreateGroupControllerTest extends ApiControllerTestCase
|
||||
$group = Group::where('icon', $this->data['icon'])->firstOrFail();
|
||||
|
||||
foreach ($this->data as $property => $value) {
|
||||
$this->assertEquals($value, array_get($data, "data.attributes.$property"), "$property not matching to json response");
|
||||
$this->assertEquals($value, Arr::get($data, "data.attributes.$property"), "$property not matching to json response");
|
||||
$property = Str::snake($property);
|
||||
$this->assertEquals($value, $group->{$property}, "$property not matching to database result");
|
||||
}
|
||||
|
Reference in New Issue
Block a user