koel/tests/Feature/V6/PlayCountTest.php

31 lines
677 B
PHP
Raw Normal View History

2022-07-26 21:05:43 +00:00
<?php
namespace Tests\Feature\V6;
use App\Models\Interaction;
class PlayCountTest extends TestCase
{
public function testStore(): void
{
/** @var Interaction $interaction */
$interaction = Interaction::factory()->create([
'play_count' => 10,
]);
$response = $this->postAsUser('/api/interaction/play', [
'song' => $interaction->song->id,
], $interaction->user);
$response->assertJsonStructure([
'type',
'id',
'song_id',
'liked',
'play_count',
]);
self::assertEquals(11, $interaction->refresh()->play_count);
}
}