Skip to content

Commit

Permalink
Merge pull request #194 from rimi-itk/feature/872-rrule-test
Browse files Browse the repository at this point in the history
872: Cleaned up test run documentation
  • Loading branch information
tuj authored Mar 19, 2024
2 parents 586ef2d + 103f838 commit a4bc185
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

- [#194](https://github.com/os2display/display-api-service/pull/194)
Updated test run documentation and added test for `rrule` in playlist.
- Fixed issue with PlaylistSlide transaction.
- Fixed issues with feed following api platform upgrade.
- [#192](https://github.com/os2display/display-api-service/pull/192)
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,24 +218,30 @@ docker compose exec phpfpm composer normalize

### Tests

Run tests with
Initialize test database:

``` shell
docker compose exec phpfpm composer test-setup
```

Run tests:

```shell
docker compose exec phpfpm composer tests
docker compose exec phpfpm composer test
```

Run a limited number of tests by passing command line parameters to `tests/test.sh`.
A limited number of tests can be run by passing command line parameters to the command.

By file

```shell
./tests/run-test.sh tests/Api/UserTest.php
docker compose exec phpfpm composer test tests/Api/UserTest.php
```

or by filtering to one method in the file

```shell
./tests/run-test.sh --filter testExternalUserFlow tests/Api/UserTest.php
docker compose exec phpfpm composer test tests/Api/UserTest.php --filter testExternalUserFlow
```

### Check Coding Standard
Expand Down
18 changes: 18 additions & 0 deletions tests/Api/PlaylistsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\Entity\Tenant\Playlist;
use App\Tests\AbstractBaseApiTestCase;
use Symfony\Component\HttpFoundation\Response;

class PlaylistsTest extends AbstractBaseApiTestCase
{
Expand Down Expand Up @@ -196,6 +197,23 @@ public function testCreatePlaylist(): void
]);
$this->assertMatchesRegularExpression('@^/v\d/\w+/([A-Za-z0-9]{26})$@', $response->toArray()['@id']);

// Test rrule on created playlist
$this->getAuthenticatedClient()->request('GET', $response->toArray()['@id']);
$this->assertResponseStatusCodeSame(Response::HTTP_OK);
$this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8');
$this->assertJsonContains([
'schedules' => [
[
'rrule' => 'DTSTART:20211102T232610Z\nRRULE:FREQ=MINUTELY;COUNT=11;INTERVAL=8',
'duration' => 1000,
],
[
'rrule' => 'DTSTART:20211102T232610Z\nRRULE:FREQ=MINUTELY;COUNT=11;INTERVAL=8',
'duration' => 2000,
],
],
]);

// @TODO: published: Object value found, but an array is required
// $this->assertMatchesResourceItemJsonSchema(Playlist::class);
}
Expand Down

0 comments on commit a4bc185

Please sign in to comment.