Revert "Release 20200823.1100"

This commit is contained in:
shibafu
2020-08-23 12:28:21 +09:00
committed by GitHub
parent f377b143d2
commit 1b5f690f4e
71 changed files with 1200 additions and 4372 deletions

View File

@@ -1,75 +0,0 @@
<?php
namespace Tests\Feature\Setting;
use App\CheckinWebhook;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class WebhookTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->seed();
}
public function testStoreWebhooks()
{
$user = factory(User::class)->create();
$response = $this->actingAs($user)
->followingRedirects()
->post('/setting/webhooks', ['name' => 'example']);
$response->assertStatus(200)
->assertViewIs('setting.webhooks');
$this->assertDatabaseHas('checkin_webhooks', ['user_id' => $user->id, 'name' => 'example']);
}
public function testStoreWebhooksHas9Hooks()
{
$user = factory(User::class)->create();
$webhooks = factory(CheckinWebhook::class, CheckinWebhook::PER_USER_LIMIT - 1)->create(['user_id' => $user->id]);
$response = $this->actingAs($user)
->followingRedirects()
->post('/setting/webhooks', ['name' => 'example9']);
$response->assertStatus(200)
->assertViewIs('setting.webhooks');
$this->assertDatabaseHas('checkin_webhooks', ['user_id' => $user->id, 'name' => 'example9']);
}
public function testStoreWebhooksHas10Hooks()
{
$user = factory(User::class)->create();
$webhooks = factory(CheckinWebhook::class, CheckinWebhook::PER_USER_LIMIT)->create(['user_id' => $user->id]);
$response = $this->actingAs($user)
->followingRedirects()
->post('/setting/webhooks', ['name' => 'example10']);
$response->assertStatus(200)
->assertViewIs('setting.webhooks');
$this->assertDatabaseMissing('checkin_webhooks', ['user_id' => $user->id, 'name' => 'example10']);
}
public function testDestroyWebhooks()
{
$user = factory(User::class)->create();
$webhook = factory(CheckinWebhook::class)->create(['user_id' => $user->id]);
$response = $this->actingAs($user)
->followingRedirects()
->delete('/setting/webhooks/' . $webhook->id);
$response->assertStatus(200)
->assertViewIs('setting.webhooks')
->assertSee('削除しました');
$this->assertTrue($webhook->refresh()->trashed());
}
}