for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Lichtenwallner (https://lichtenwallner.at)
*
* @see https://github.com/jolicht/markdown-cms for the canonical source repository
* @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT
* @copyright Copyright (c) Johannes Lichtenwallner
*/
declare(strict_types = 1);
namespace JolichtTest\MarkdownCms\CommonMark;
use PHPUnit\Framework\TestCase;
use Jolicht\MarkdownCms\CommonMark\EnvironmentFactory;
use Interop\Container\ContainerInterface;
use League\CommonMark\Environment;
use League\CommonMark\Inline\Element\Image;
use Jolicht\MarkdownCms\Markdown\Renderer\ImageRenderer;
class EnvironmentFactoryTest extends TestCase
{
private $factory;
protected function setUp()
$this->factory = new EnvironmentFactory();
}
public function testCreateService()
$container = $this->prophesize(ContainerInterface::class);
$imageRenderer = $this->prophesize(ImageRenderer::class);
$container
->get(ImageRenderer::class)
->willReturn($imageRenderer->reveal());
$environment = $this->factory->__invoke($container->reveal());
$this->assertInstanceOf(Environment::class, $environment);
$this->assertInstanceOf(ImageRenderer::class, $environment->getInlineRendererForClass(Image::class));