Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming Expander to YamlExpander. #17

Merged
merged 1 commit into from
Aug 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/Expander.php → src/YamlExpander.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
namespace Grasmash\YamlExpander;

use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Component\Yaml\Yaml;
use Grasmash\Expander\Expander as GrasmashExpander;
use Grasmash\Expander\Expander;

/**
* Class Expander
* Class YamlExpander
* @package Grasmash\YamlExpander
*/
class Expander
class YamlExpander
{
/**
* @var \Psr\Log\LoggerInterface
Expand All @@ -24,14 +23,14 @@ class Expander
protected $expander;

/**
* Expander constructor.
* YamlExpander constructor.
*
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
$this->expander = new GrasmashExpander();
$this->expander = new Expander();
$this->expander->setLogger($logger);
$this->expander->setStringifier(new Stringifier());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
namespace Grasmash\YamlExpander\Tests\Command;

use Dflydev\DotAccessData\Data;
use Grasmash\YamlExpander\Expander;
use Grasmash\YamlExpander\YamlExpander;
use Grasmash\YamlExpander\Stringifier;
use Grasmash\YamlExpander\Tests\TestBase;
use Psr\Log\NullLogger;
use Symfony\Component\Yaml\Yaml;

class ExpanderTest extends \PHPUnit_Framework_TestCase
class YamlExpanderTest extends \PHPUnit_Framework_TestCase
{

/**
* Tests Expander::expandArrayProperties().
* Tests YamlExpander::expandArrayProperties().
*
* @param string $filename
* @param array $reference_array
Expand All @@ -24,7 +24,7 @@ public function testExpandArrayProperties($filename, $reference_array)
{
$array = Yaml::parse(file_get_contents(__DIR__ . "/../resources/$filename"));
putenv("test=gomjabbar");
$expander = new Expander(new NullLogger());
$expander = new YamlExpander(new NullLogger());
$expanded = $expander->expandArrayProperties($array);
$this->assertEquals('gomjabbar', $expanded['env-test']);
$this->assertEquals('Frank Herbert 1965', $expanded['book']['copyright']);
Expand All @@ -40,7 +40,7 @@ public function testExpandArrayProperties($filename, $reference_array)
}

/**
* Tests Expander::parse().
* Tests YamlExpander::parse().
*
* @param string $filename
* @param array $reference_array
Expand All @@ -50,7 +50,7 @@ public function testExpandArrayProperties($filename, $reference_array)
public function testParse($filename, $reference_array)
{
$yaml_string = file_get_contents(__DIR__ . "/../resources/$filename");
$expander = new Expander(new NullLogger());
$expander = new YamlExpander(new NullLogger());
$expanded = $expander->parse($yaml_string);
$this->assertEquals('Frank Herbert 1965', $expanded['book']['copyright']);
$this->assertEquals('Paul Atreides', $expanded['book']['protaganist']);
Expand Down Expand Up @@ -78,7 +78,7 @@ public function providerYaml()
}

/**
* Tests Expander::expandProperty().
* Tests YamlExpander::expandProperty().
*/
public function testStringifyArray()
{
Expand Down