Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from core23/develop
Increased test coverage
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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')); | ||
} | ||
} |