Skip to content

Commit

Permalink
Not only expect the exception but also its message
Browse files Browse the repository at this point in the history
  • Loading branch information
ravage84 committed Sep 5, 2018
1 parent 0e4ff8c commit a57ba73
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/TestCase/Cache/SimpleCacheEngineTest.php
Expand Up @@ -94,6 +94,7 @@ public function testGetNoKey()
public function testGetInvalidKey()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('A cache key must be a non-empty string.');
$this->cache->get('');
}

Expand Down Expand Up @@ -137,6 +138,7 @@ public function testSetWithTtl()
public function testSetInvalidKey()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('A cache key must be a non-empty string.');
$this->cache->set('', 'some data');
}

Expand All @@ -163,6 +165,7 @@ public function testDelete()
public function testDeleteInvalidKey()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('A cache key must be a non-empty string.');
$this->cache->delete('');
}

Expand Down Expand Up @@ -401,6 +404,7 @@ public function testHas()
public function testHasInvalidKey()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('A cache key must be a non-empty string.');
$this->cache->has('');
}
}

0 comments on commit a57ba73

Please sign in to comment.