1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Applied latest StyleCI changes

This commit is contained in:
Dan Brown
2021-12-18 11:43:05 +00:00
parent a3ead5062a
commit 04f37e21e2
13 changed files with 53 additions and 52 deletions

View File

@ -2,6 +2,7 @@
namespace Tests\Actions;
use function app;
use BookStack\Actions\Activity;
use BookStack\Actions\ActivityLogger;
use BookStack\Actions\ActivityType;
@ -11,9 +12,8 @@ use BookStack\Entities\Models\Page;
use BookStack\Entities\Repos\PageRepo;
use BookStack\Entities\Tools\TrashCan;
use Carbon\Carbon;
use Tests\TestCase;
use function app;
use function config;
use Tests\TestCase;
class AuditLogTest extends TestCase
{

View File

@ -15,7 +15,6 @@ use Tests\TestCase;
class WebhookCallTest extends TestCase
{
public function test_webhook_listening_to_all_called_on_event()
{
$this->newWebhook([], ['all']);
@ -73,8 +72,9 @@ class WebhookCallTest extends TestCase
$this->runEvent(ActivityType::PAGE_UPDATE, $page, $editor);
Http::assertSent(function(Request $request) use ($editor, $page, $webhook) {
Http::assertSent(function (Request $request) use ($editor, $page, $webhook) {
$reqData = $request->data();
return $request->isJson()
&& $reqData['event'] === 'page_update'
&& $reqData['text'] === ($editor->name . ' updated page "' . $page->name . '"')
@ -88,7 +88,6 @@ class WebhookCallTest extends TestCase
});
}
protected function runEvent(string $event, $detail = '', ?User $user = null)
{
if (is_null($user)) {
@ -112,5 +111,4 @@ class WebhookCallTest extends TestCase
return $webhook;
}
}
}

View File

@ -8,11 +8,10 @@ use Tests\TestCase;
class WebhookManagementTest extends TestCase
{
public function test_index_view()
{
$webhook = $this->newWebhook([
'name' => 'My awesome webhook',
'name' => 'My awesome webhook',
'endpoint' => 'https://example.com/donkey/webhook',
], ['all']);
@ -36,10 +35,10 @@ class WebhookManagementTest extends TestCase
public function test_store()
{
$resp = $this->asAdmin()->post('/settings/webhooks/create', [
'name' => 'My first webhook',
'name' => 'My first webhook',
'endpoint' => 'https://example.com/webhook',
'events' => ['all'],
'active' => 'true'
'events' => ['all'],
'active' => 'true',
]);
$resp->assertRedirect('/settings/webhooks');
@ -49,16 +48,16 @@ class WebhookManagementTest extends TestCase
$resp->assertSee('Webhook successfully created');
$this->assertDatabaseHas('webhooks', [
'name' => 'My first webhook',
'name' => 'My first webhook',
'endpoint' => 'https://example.com/webhook',
'active' => true,
'active' => true,
]);
/** @var Webhook $webhook */
$webhook = Webhook::query()->where('name', '=', 'My first webhook')->first();
$this->assertDatabaseHas('webhook_tracked_events', [
'webhook_id' => $webhook->id,
'event' => 'all',
'event' => 'all',
]);
}
@ -79,10 +78,10 @@ class WebhookManagementTest extends TestCase
$webhook = $this->newWebhook();
$resp = $this->asAdmin()->put('/settings/webhooks/' . $webhook->id, [
'name' => 'My updated webhook',
'name' => 'My updated webhook',
'endpoint' => 'https://example.com/updated-webhook',
'events' => [ActivityType::PAGE_CREATE, ActivityType::PAGE_UPDATE],
'active' => 'true'
'events' => [ActivityType::PAGE_CREATE, ActivityType::PAGE_UPDATE],
'active' => 'true',
]);
$resp->assertRedirect('/settings/webhooks');
@ -90,10 +89,10 @@ class WebhookManagementTest extends TestCase
$resp->assertSee('Webhook successfully updated');
$this->assertDatabaseHas('webhooks', [
'id' => $webhook->id,
'name' => 'My updated webhook',
'id' => $webhook->id,
'name' => 'My updated webhook',
'endpoint' => 'https://example.com/updated-webhook',
'active' => true,
'active' => true,
]);
$trackedEvents = $webhook->trackedEvents()->get();
@ -169,5 +168,4 @@ class WebhookManagementTest extends TestCase
return $webhook;
}
}
}

View File

@ -407,7 +407,7 @@ class EntitySearchTest extends TestCase
{
$this->newPage([
'name' => 'Test Page',
'html' => '<p>На мен ми трябва нещо добро test</p>'
'html' => '<p>На мен ми трябва нещо добро test</p>',
]);
$search = $this->asEditor()->get('/search?term=' . urlencode('На мен ми трябва нещо добро'));