Skip to content

Commit

Permalink
Added 7.1 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesvdvreken committed Jun 19, 2017
1 parent 56b0e3c commit f76a032
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ matrix:
- php: 5.6
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.0
- php: 7.1
env: COLLECT_COVERAGE="--coverage-clover build/coverage.clover"
- php: hhvm
dist: trusty
Expand Down
19 changes: 13 additions & 6 deletions tests/unit/Laravel/CacheItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Madewithlove\IlluminatePsrCacheBridge\Tests\Unit\Laravel;

use Carbon\Carbon;
use DateTimeImmutable;
use Madewithlove\IlluminatePsrCacheBridge\Laravel\CacheItem;
use PHPUnit_Framework_TestCase;
use Psr\Cache\CacheItemInterface;
Expand Down Expand Up @@ -45,8 +46,8 @@ public function it_remembers_its_key_and_value()
// Act

// Assert
$this->assertEquals('key', $item->getKey());
$this->assertEquals($value, $item->get());
$this->assertSame('key', $item->getKey());
$this->assertSame($value, $item->get());
}

/** @test */
Expand All @@ -58,7 +59,10 @@ public function it_can_set_ttl_in_seconds()
// Act

// Assert
$this->assertEquals(new \DateTimeImmutable('+ 1 minute'), $expiringInExactlyOneMinute->getExpiresAt());
$this->assertSame(
(new DateTimeImmutable('+ 1 minute'))->format('d-m-Y H:i:s'),
$expiringInExactlyOneMinute->getExpiresAt()->format('d-m-Y H:i:s')
);
}

/** @test */
Expand All @@ -70,7 +74,10 @@ public function it_can_set_ttl_with_date_interval()
// Act

// Assert
$this->assertEquals(new \DateTimeImmutable('+ 1 minute'), $expiringInExactlyOneMinute->getExpiresAt());
$this->assertSame(
(new DateTimeImmutable('+ 1 minute'))->format('d-m-Y H:i:s'),
$expiringInExactlyOneMinute->getExpiresAt()->format('d-m-Y H:i:s')
);
}

/** @test */
Expand All @@ -84,7 +91,7 @@ public function it_can_set_expiry_with_datetime()
$item->expiresAt($now->addMinute());

// Assert
$this->assertTrue($now == $item->getExpiresAt());
$this->assertEquals($now, $item->getExpiresAt());
}

/** @test */
Expand All @@ -109,7 +116,7 @@ public function it_will_remember_value_that_has_been_set()
$item->set('bar');

// Assert
$this->assertEquals('bar', $item->get());
$this->assertSame('bar', $item->get());
}

/** @test */
Expand Down

0 comments on commit f76a032

Please sign in to comment.