Cache\Adapter\Common\Tests\CacheItemTest::testExpiresAfter PHP Method

testExpiresAfter() public method

public testExpiresAfter ( )
    public function testExpiresAfter()
    {
        $item = new CacheItem('test_key');
        $this->assertNull($item->getExpirationDate());
        $item->expiresAfter(null);
        $this->assertNull($this->getExpectedException());
        $item->expiresAfter(new \DateInterval('PT1S'));
        $this->assertEquals(new \DateTime('+1 second'), $item->getExpirationDate());
        $item->expiresAfter(1);
        $this->assertEquals(new \DateTime('+1 second'), $item->getExpirationDate());
    }