Skip to content

Commit

Permalink
Merge two similar tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
reinink committed Jan 19, 2017
1 parent eded0a9 commit ae63510
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions tests/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public function testGetSourcePathWithBaseUrl()
{
$this->server->setBaseUrl('img/');
$this->assertEquals('image.jpg', $this->server->getSourcePath('img/image.jpg'));

// Test for a bug where if the path starts with the same substring as the base url, the source
// path would trim the base url off the filename. eg, the following would've returned 'ur.jpg'
$this->assertEquals('imgur.jpg', $this->server->getSourcePath('imgur.jpg'));
}

public function testGetSourcePathWithPrefix()
Expand All @@ -78,16 +82,6 @@ public function testGetSourcePathWithPrefix()
$this->assertEquals('img/image.jpg', $this->server->getSourcePath('image.jpg'));
}

public function testGetsSourcePathWithBaseUrl()
{
$this->server->setBaseUrl('img/');
$this->assertEquals('image.jpg', $this->server->getSourcePath('image.jpg'));

// Test for a bug where if the path starts with the same substring as the base url, the source
// path would trim the base url off the filename. eg, the following would've returned 'ur.jpg'
$this->assertEquals('imgur.jpg', $this->server->getSourcePath('imgur.jpg'));
}

public function testGetSourcePathWithMissingPath()
{
$this->setExpectedException(
Expand Down Expand Up @@ -198,34 +192,34 @@ public function testGetCachePathWithSourcePrefix()
$this->server->setSourcePathPrefix('img/');
$this->assertEquals('image.jpg/75094881e9fd2b93063d6a5cb083091c', $this->server->getCachePath('image.jpg', []));
}

public function testGetCachePathWithExtension()
{
$this->server->setCacheWithFileExtensions(true);
$this->assertEquals('image.jpg/75094881e9fd2b93063d6a5cb083091c.jpg', $this->server->getCachePath('image.jpg', []));
}

public function testGetCachePathWithExtensionAndFmParam()
{
$this->server->setCacheWithFileExtensions(true);
$this->assertEquals('image.jpg/eb6091e07fb06219634a3c82afb88239.gif', $this->server->getCachePath('image.jpg', ['fm' => 'gif']));
}

public function testGetCachePathWithExtensionAndFmFromDefaults()
{
$this->server->setCacheWithFileExtensions(true);
$this->server->setDefaults(['fm' => 'gif']);
$this->assertEquals('image.jpg/eb6091e07fb06219634a3c82afb88239.gif', $this->server->getCachePath('image.jpg', []));
}

public function testGetCachePathWithExtensionAndFmFromPreset()
{
$this->server->setCacheWithFileExtensions(true);

$this->server->setPresets(['gif' => [
'fm' => 'gif'
'fm' => 'gif',
]]);

$this->assertEquals('image.jpg/eb6091e07fb06219634a3c82afb88239.gif', $this->server->getCachePath('image.jpg', ['p' => 'gif']));
}

Expand Down

0 comments on commit ae63510

Please sign in to comment.