Skip to content

Commit

Permalink
Merge pull request #18 from core23/develop
Browse files Browse the repository at this point in the history
Increased test coverage
  • Loading branch information
core23 committed May 11, 2019
2 parents 0bdc1f8 + 4cd66a6 commit 42361c6
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/Filter/PeriodTest.php
@@ -0,0 +1,46 @@
<?php

/*
* (c) Christian Gripp <mail@core23.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Core23\LastFm\Tests\Filter;

use Core23\LastFm\Filter\Period;
use PHPUnit\Framework\TestCase;

class PeriodTest extends TestCase
{
public function testOverall(): void
{
static::assertSame('overall', Period::overall()->getValue());
}

public function testWeek(): void
{
static::assertSame('7day', Period::week()->getValue());
}

public function testMonth(): void
{
static::assertSame('1month', Period::month()->getValue());
}

public function testQuarterYear(): void
{
static::assertSame('3month', Period::quarterYear()->getValue());
}

public function testHalfYear(): void
{
static::assertSame('6month', Period::halfYear()->getValue());
}

public function testYear(): void
{
static::assertSame('12month', Period::year()->getValue());
}
}
35 changes: 35 additions & 0 deletions tests/Filter/RangeFilterTest.php
@@ -0,0 +1,35 @@
<?php

/*
* (c) Christian Gripp <mail@core23.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Core23\LastFm\Tests\Filter;

use Core23\LastFm\Filter\RangeFilter;
use DateTime;
use PHPUnit\Framework\TestCase;

class RangeFilterTest extends TestCase
{
public function testItIsInstantiable(): void
{
static::assertNotNull(new RangeFilter(null, null));
}

public function testGetQuery(): void
{
$start = new DateTime();
$end = new DateTime('tomorrow');

$filter = new RangeFilter($start, $end);

static::assertSame([
'foo' => $start->getTimestamp(),
'bar' => $end->getTimestamp(),
], $filter->getQuery('foo', 'bar'));
}
}

0 comments on commit 42361c6

Please sign in to comment.