<commit_before><?php

namespace Tests\Unit\Domain\Model\Article;

use Domain\Model\Article\Article;
use Domain\Model\Common\VO\EmailField;
use Domain\Model\Common\VO\NameField;
use Domain\Model\Common\VO\PhoneField;
use Domain\Model\Supplier\Supplier;
use PHPUnit\Framework\TestCase;

class ArticleTest extends TestCase
{
    final public function testInstantiateArticle(): void
    {
        // Arrange
        $supplier = Supplier::create(
            NameField::fromString('Davigel'),
            '15, rue des givrés',
            '75000',
            'Paris',
            'France',
            PhoneField::fromString('+33100000001'),
            PhoneField::fromString('+33100000002'),
            EmailField::fromString('<EMAIL>'),
            'David',
            PhoneField::fromString('+33600000001'),
            'Surgelé',
            3,
            [1, 3]
        );

        //Act
        $article = Article::create(
            NameField::fromString('<NAME> 6kg'),
            $supplier,
            'KG',
            6.000,
            6.82,
            '10%',
            8.8,
            ['Chambre positive'],
            'Frais:Viande'
        );

        // Assert
        $this->assertEquals(
            new Article(
                NameField::fromString('<NAME> 6kg'),
                $supplier,
                'KG',
                6.000,
                6.82,
                '10%',
                8.8,
                ['Chambre positive'],
                'Frais:Viande'
            ),
            $article
        );
    }

    final public function testChangeName(): void
    {
        // Arrange
        $supplier = Supplier::create(
            NameField::fromString('Davigel'),
            '15, rue des givrés',
            '75000',
            'Paris',
            'France',
            PhoneField::fromString('+33100000001'),
            PhoneField::fromString('+33100000002'),
            EmailField::fromString('<EMAIL>'),
            'David',
            PhoneField::fromString('+33600000001'),
            'Surgelé',
            3,
            [1, 3]
        );
        $article = Article::create(
            NameField::fromString('Jambon Trad 6kg'),
            $supplier,
            'KG',
            6.000,
            6.82,
            '10%',
            8.8,
            ['Chambre positive'],
            'Frais:Viande'
        );

        // Act
        $article->renameArticle(NameField::fromString('Jambon Tradition 6kg'));

        // Assert
        $this->assertEquals(
            new Article(
                NameField::fromString('Jambon Tradition 6kg'),
                $supplier,
                'KG',
                6.000,
                6.82,
                '10%',
                8.8,
                ['Chambre positive'],
                'Frais:Viande'
            ),
            $article
        );
    }
}<commit_msg>feat: add Supplier entity<commit_after><?php

declare(strict_types=1);

namespace Tests\Unit\Domain\Model\Article;

use Domain\Model\Article\Article;
use Domain\Model\Article\VO\Packaging;
use Domain\Model\Common\VO\EmailField;
use Domain\Model\Common\VO\NameField;
use Domain\Model\Common\VO\PhoneField;
use Domain\Model\Supplier\Supplier;
use PHPUnit\Framework\TestCase;

class ArticleTest extends TestCase
{
    final public function testInstantiateArticle(): void
    {
        // Arrange
        $supplier = Supplier::create(
            NameField::fromString('Davigel'),
            '15, rue des givrés',
            '75000',
            'Paris',
            'France',
            PhoneField::fromString('+33100000001'),
            PhoneField::fromString('+33100000002'),
            EmailField::fromString('<EMAIL>'),
            'David',
            PhoneField::fromString('+33600000001'),
            'Surgelé',
            3,
            [1, 3]
        );

        //Act
        $article = Article::create(
            NameField::fromString('Jambon Trad 6kg'),
            $supplier,
            'KG',
            Packaging::fromArray([['Colis', 1], ['pièce', 2], ['kilogramme', 6.000]]),
            6.82,
            '10%',
            8.8,
            ['Chambre positive'],
            'Frais:Viande'
        );

        // Assert
        $this->assertEquals(
            new Article(
                NameField::fromString('Jambon Trad 6kg'),
                $supplier,
                'KG',
                Packaging::fromArray([['Colis', 1], ['pièce', 2], ['kilogramme', 6.000]]),
                6.82,
                '10%',
                8.8,
                ['Chambre positive'],
                'Frais:Viande'
            ),
            $article
        );
    }

    final public function testChangeName(): void
    {
        // Arrange
        $supplier = Supplier::create(
            NameField::fromString('Davigel'),
            '15, rue des givrés',
            '75000',
            'Paris',
            'France',
            PhoneField::fromString('+33100000001'),
            PhoneField::fromString('+33100000002'),
            EmailField::fromString('<EMAIL>'),
            'David',
            PhoneField::fromString('+33600000001'),
            'Surgelé',
            3,
            [1, 3]
        );
        $article = Article::create(
            NameField::fromString('Jambon Trad 6kg'),
            $supplier,
            'KG',
            Packaging::fromArray([['Colis', 1], ['pièce', 2], ['kilogramme', 6.000]]),
            6.82,
            '10%',
            8.8,
            ['Chambre positive'],
            'Frais:Viande'
        );

        // Act
        $article->renameArticle(NameField::fromString('Jambon Tradition 6kg'));

        // Assert
        $this->assertEquals(
            new Article(
                NameField::fromString('Jambon Tradition 6kg'),
                $supplier,
                'KG',
                Packaging::fromArray([['Colis', 1], ['pièce', 2], ['kilogramme', 6.000]]),
                6.82,
                '10%',
                8.8,
                ['Chambre positive'],
                'Frais:Viande'
            ),
            $article
        );
    }
}
{'fraction_non_alphanumeric': 0.1369504821049191, 'fraction_numerical': 0.045595685569537504, 'mean_word_length': 1.3611111111111112, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 12, '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': '5443598', 'n_tokens_mistral': 1930, 'n_tokens_neox': 1683, 'n_words': 296}