Skip to content

Commit

Permalink
Added test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilge committed Aug 25, 2020
1 parent e5eb26c commit 3c225f6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Expand Up @@ -6,11 +6,10 @@ sudo: false
language: php

php:
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

env:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -8,7 +8,7 @@
}
],
"require": {
"php": "^7",
"php": "^7.1",
"scriptfusion/static-class": "^1"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Generate/Date.php → src/Date.php
@@ -1,7 +1,7 @@
<?php
declare(strict_types=1);

namespace ScriptFUSION\Steam250\SiteGenerator\Generate;
namespace ScriptFUSION\Type;

use ScriptFUSION\StaticClass;

Expand Down
38 changes: 38 additions & 0 deletions test/DateTest.php
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);

namespace ScriptFUSIONTest\Type;

use ScriptFUSION\Type\Date;
use PHPUnit\Framework\TestCase;

/**
* @see Date
*/
final class DateTest extends TestCase
{
public function testToday(): void
{
self::assertSame('today', Date::adapt(new \DateTime));
}

public function testYesterday(): void
{
self::assertSame('yesterday', Date::adapt(new \DateTime('-1 day')));
}

public function testLastWeek(): void
{
self::assertSame('7 days', Date::adapt(new \DateTime('-7 day')));
}

public function test30DaysAgo(): void
{
self::assertSame('30 days', Date::adapt(new \DateTime('-30 day')));
}

public function test31DaysAgo(): void
{
self::assertSame(($date = new \DateTime('-31 day'))->format('M Y'), Date::adapt($date));
}
}

0 comments on commit 3c225f6

Please sign in to comment.