Skip to content

Commit

Permalink
cleanup and tests to 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Wilson committed Aug 22, 2016
1 parent 240526c commit 1002f37
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/FileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public function addFiles($files)

/**
* Process the current FileBag and return an array
* @param bool $ns
* @return array
* @throws Exception
*/
public function process($ns = true)
{
Expand Down
20 changes: 20 additions & 0 deletions tests/Integration/Managers/BasicManagerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
namespace Michaels\Manager\Test\Managers\Integration;

use Michaels\Manager\BasicManager;
use Michaels\Manager\Test\Scenarios\InitManagerScenario;
use Michaels\Manager\Test\Scenarios\ManagesItemsScenario;

/**
* Tests customized implementations of Manager.
* Does NOT test ManagesItemsTrait api.
*/
class BasicManagerTest extends \PHPUnit_Framework_TestCase
{
use ManagesItemsScenario, InitManagerScenario;

public function getManager($items = [])
{
return new BasicManager($items);
}
}
13 changes: 13 additions & 0 deletions tests/Scenarios/LoadsFilesScenario.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ public function test_loading_files()
$this->assertEquals($this->defaultArray, $manager->all());
}

public function test_load_single_file()
{
$this->setupDefaultArray();
$manager = $this->getManager();
$manager->loadFile(new \SplFileInfo(realpath(__DIR__ . '/../Fixtures/FilesWithGoodData/jsonConfig.json')));

$expected = $this->defaultArray;
unset($expected['phpConfig']);
unset($expected['yamlConfig']);

$this->assertEquals($expected, $manager->all());
}

public function test_with_decoder()
{
$goodCustomTestFileDirectory = realpath(__DIR__ . '/../Fixtures/CustomFileWithGoodData');
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Bags/FileBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class FileBagTest extends \PHPUnit_Framework_TestCase

private $badTestFileObjects = [];

/** @var FileBag */
private $fileBag;

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/Decoders/JsonDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class JsonDecoderTest extends \PHPUnit_Framework_TestCase
{
private $jsonData;
private $testArrayData;

/** @var JsonDecoder */
private $jsonDecoder;

public function setup()
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/Decoders/PhpDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class PhpDecoderTest extends \PHPUnit_Framework_TestCase
{
private $phpData;
private $testArrayData;

/** @var PhpDecoder */
private $phpDecoder;

public function setup()
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/Decoders/YamlDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class YamlDecoderTest extends \PHPUnit_Framework_TestCase
{
private $yamlData;
private $testArrayData;

/** @var YamlDecoder */
private $yamlDecoder;

public function setup()
Expand Down

0 comments on commit 1002f37

Please sign in to comment.