Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Do not mock out Config class in AutoloaderTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jedrzejchalubek committed Mar 7, 2017
1 parent cfcdd3e commit e8c0f6b
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions tests/Gin/Foundation/AutoloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ public function test_relative_path_getter()
$config = $this->getConfig();
$autoloader = $this->getAutoloader($config);

$config->shouldReceive('offsetGet')
->with('directories')
->andReturn(['src' => 'src']);

$this->assertEquals($autoloader->getRelativePath('file/to/load.php'), 'src/file/to/load.php');
}

Expand All @@ -31,14 +27,6 @@ public function test_path_getter()
$config = $this->getConfig();
$autoloader = $this->getAutoloader($config);

$config->shouldReceive('offsetGet')
->with('directories')
->andReturn(['src' => 'src']);

$config->shouldReceive('offsetGet')
->with('paths')
->andReturn(['directory' => 'abs/path']);

$this->assertEquals($autoloader->getPath('file/to/load.php'), 'abs/path/src/file/to/load.php');
}

Expand All @@ -57,18 +45,6 @@ public function it_should_throw_if_no_file()

$this->expectException(FileNotFoundException::class);

$config->shouldReceive('offsetGet')
->with('directories')
->andReturn(['src' => 'src']);

$config->shouldReceive('offsetGet')
->with('paths')
->andReturn(['directory' => 'abs/path']);

$config->shouldReceive('offsetGet')
->with('autoload')
->andReturn(['file/to/load.php']);

$autoloader->register();
}

Expand All @@ -88,24 +64,12 @@ public function it_should_return_true_on_successfully_autoloading()
->with('src/file/to/load.php', true, true)
->andReturn(true);

$config->shouldReceive('offsetGet')
->with('directories')
->andReturn(['src' => 'src']);

$config->shouldReceive('offsetGet')
->with('paths')
->andReturn(['directory' => 'abs/path']);

$config->shouldReceive('offsetGet')
->with('autoload')
->andReturn(['file/to/load.php']);

$autoloader->register();
}

public function getConfig()
{
return Mockery::mock(Config::class, [
return new Config([
'paths' => [
'directory' => 'abs/path',
],
Expand Down

0 comments on commit e8c0f6b

Please sign in to comment.