Skip to content

Commit

Permalink
Merge pull request #121 from filipgolonka/environment_decoupling
Browse files Browse the repository at this point in the history
Removed configuring converters in Environment constructor
  • Loading branch information
colinodell authored Dec 28, 2016
2 parents 3f89244 + d218d62 commit f5e3fdf
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ You can pass current `Environment` object to customize i.e. which converters sho

```php
$environment = new Environment(array(
'converters' => array(
new HeaderConverter(),
),
// your configuration here
));
$environment->addConverter(new HeaderConverter()); // optionally - add converter manually

$converter = new HtmlConverter($environment);

Expand Down
7 changes: 0 additions & 7 deletions src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ final class Environment
public function __construct(array $config = array())
{
$this->config = new Configuration($config);

if (isset($config['converters'])) {
foreach ($config['converters'] as $converter) {
$this->addConverter($converter);
}
}

$this->addConverter(new DefaultConverter());
}

Expand Down
19 changes: 0 additions & 19 deletions tests/EnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,10 @@

namespace League\HTMLToMarkdown\Test;

use League\HTMLToMarkdown\Converter\HeaderConverter;
use League\HTMLToMarkdown\Environment;

class EnvironmentTest extends \PHPUnit_Framework_TestCase
{
public function test_creation_with_converters()
{
$environment = new Environment(array(
'converters' => array(
new HeaderConverter(),
),
));

$this->assertInstanceOf(
'League\HTMLToMarkdown\Converter\HeaderConverter',
$environment->getConverterByTag('h3')
);
$this->assertInstanceOf(
'League\HTMLToMarkdown\Converter\DefaultConverter',
$environment->getConverterByTag('img')
);
}

public function test_creation()
{
$environment = Environment::createDefaultEnvironment();
Expand Down

0 comments on commit f5e3fdf

Please sign in to comment.