<commit_before><?php

namespace Brera\PoC;

use Brera\PoC\Product\Product;

class ProductSnippetRendererCollectionTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var ProductSnippetRenderer|\PHPUnit_Framework_MockObject_MockObject
     */
    private $mockRenderer;

    /**
     * @var ProductSnippetRenderer|\PHPUnit_Framework_MockObject_MockObject
     */
    private $mockRenderer2;

    /**
     * @var HardcodedProductSnippetRendererCollection
     */
    private $rendererCollection;

    /**
     * @var SnippetResultList|\PHPUnit_Framework_MockObject_MockObject
     */
    private $stubSnippetResultList;


    public function setUp()
    {
        $this->stubSnippetResultList
            = $this->getMock(SnippetResultList::class, array('merge'));

        $this->mockRenderer = $this->getMock(ProductSnippetRenderer::class,
            array('render'));

        $this->mockRenderer2 = $this->getMock(ProductSnippetRenderer::class,
            array('render'));

        $rendererArray = [$this->mockRenderer, $this->mockRenderer2];

        $this->rendererCollection
            = new HardcodedProductSnippetRendererCollection(
            $rendererArray,
            $this->stubSnippetResultList
        );
    }

    /**
     * @test
     */
    public function itShouldReturnARenderResultList()
    {
        $stubProduct = $this->getMockBuilder(Product::class)
            ->disableOriginalConstructor()
            ->getMock();

        $stubEnvironment = $this->getMock(Environment::class);


        $snippetResultList = $this->rendererCollection->render(
            $stubProduct, $stubEnvironment
        );<commit_msg>Issue #1: Refactor to use interface SnippetRenderer instead of fake ProductSnippetRenderer<commit_after><?php

namespace Brera\PoC;

use Brera\PoC\Product\Product;

class ProductSnippetRendererCollectionTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var SnippetRenderer|\PHPUnit_Framework_MockObject_MockObject
     */
    private $mockRenderer;

    /**
     * @var SnippetRenderer|\PHPUnit_Framework_MockObject_MockObject
     */
    private $mockRenderer2;

    /**
     * @var HardcodedProductSnippetRendererCollection
     */
    private $rendererCollection;

    /**
     * @var SnippetResultList|\PHPUnit_Framework_MockObject_MockObject
     */
    private $stubSnippetResultList;


    public function setUp()
    {
        $this->stubSnippetResultList
            = $this->getMock(SnippetResultList::class, array('merge'));

        $this->mockRenderer = $this->getMock(SnippetRenderer::class,
            array('render'));

        $this->mockRenderer2 = $this->getMock(SnippetRenderer::class,
            array('render'));

        $this->rendererCollection = new HardcodedProductSnippetRendererCollection(
            [$this->mockRenderer, $this->mockRenderer2],
            $this->stubSnippetResultList
        );
    }

    /**
     * @test
     */
    public function itShouldReturnARenderedSnippetResultList()
    {
        $this->mockRenderer->expects($this->any())->method('render')
            ->willReturn($this->getMock(SnippetResultList::class));
        
        $this->mockRenderer2->expects($this->any())->method('render')
            ->willReturn($this->getMock(SnippetResultList::class));
        
        $stubProduct = $this->getMockBuilder(Product::class)
            ->disableOriginalConstructor()
            ->getMock();

        $stubEnvironment = $this->getMock(Environment::class);


        $snippetResultList = $this->rendererCollection->render(
            $stubProduct, $stubEnvironment
        );
{'fraction_non_alphanumeric': 0.11885587336850875, 'fraction_numerical': 0.0022216051096917524, 'mean_word_length': 2.9024918743228603, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2979134', 'n_tokens_mistral': 985, 'n_tokens_neox': 975, 'n_words': 130}