for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace FileFetcher\Tests\Phpunit;
use FileFetcher\InMemoryFileFetcher;
/**
* @covers FileFetcher\InMemoryFileFetcher
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
class InMemoryFileFetcherTest extends \PHPUnit_Framework_TestCase {
public function testWhenEmptyHash_requestsCauseException() {
$fetcher = new InMemoryFileFetcher( array() );
$this->setExpectedException( 'FileFetcher\FileFetchingException' );
$fetcher->fetchFile( 'http://foo.bar/baz' );
}
public function testWhenUrlNotKnown_requestsCauseException() {
$fetcher = new InMemoryFileFetcher( array(
'http://something.else/entirely' => 'kittens'
) );
public function testWhenUrlKnown_requestsReturnsValue() {
'http://something.else/entirely' => 'kittens',
'http://foo.bar/baz' => 'cats'
$this->assertSame( 'cats', $fetcher->fetchFile( 'http://foo.bar/baz' ) );