<commit_before><?php
/**
 * ReferenceIsUnique.php
 * @author Bolbo
 */
namespace tests\units\Bolbo\Component\Product\Model;

use Bolbo\Component\Product\Model\ReferenceIsUnique as testedClass;
use Bolbo\Component\Product\Model\Reference;
use mageekguy\atoum;

/**
 * Class ReferenceIsUnique
 * @package tests\units\Bolbo\Component\Product\Model
 */
class ReferenceIsUnique extends atoum\test
{
    /**
     * If reference already in database => productByReference return true so reference doublon ==> return false
     */
    public function testReferenceIsNotUnique()
    {
        $productRepositoryMockDoublonReference                                     = new \mock\Bolbo\Component\Product\Model\ProductRepository();
        $this->calling($productRepositoryMockDoublonReference)->productByReference = function () {
            return true;
        };

        $reference = new \mock\Bolbo\Component\Product\Model\Reference('reference');

        $testedElement = new testedClass($productRepositoryMockDoublonReference);
        $this
            ->boolean($testedElement->isSatisfiedBy($reference))
            ->isFalse();
    }

    /**<commit_msg>fix unit test for ReferenceIsUnique<commit_after><?php
/**
 * ReferenceIsUnique.php
 * @author Bolbo
 */
namespace tests\units\Bolbo\Component\Product\Model;

use Bolbo\Component\Product\Model\ReferenceIsUnique as testedClass;
use mageekguy\atoum;

/**
 * Class ReferenceIsUnique
 * @package tests\units\Bolbo\Component\Product\Model
 */
class ReferenceIsUnique extends atoum\test
{
    /**
     * If reference already in database => productByReference return true so reference doublon ==> return false
     */
    public function testReferenceIsNotUnique()
    {
        $productRepositoryMockDoublonReference                                     = new \mock\Bolbo\Component\Product\Model\ProductRepository();
        $this->calling($productRepositoryMockDoublonReference)->productByReference = function () {
            return true;
        };

        $reference = new \mock\Bolbo\Component\Product\Model\Reference('reference');

        $testedElement = new testedClass($productRepositoryMockDoublonReference);
        $this
            ->boolean($testedElement->isSatisfiedBy($reference))
            ->isFalse();
    }

    /**
{'fraction_non_alphanumeric': 0.1080017490161784, 'fraction_numerical': 0.0, 'mean_word_length': 3.049557522123894, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3831755', 'n_tokens_mistral': 616, 'n_tokens_neox': 603, 'n_words': 110}