<commit_before><?php declare(strict_types=1);

namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Small\CodeGeneration\Creation\Tests\Entity;

use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Tests\Entities\EntityTestCreator;
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FileFactory;
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FindReplaceFactory;
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\File\Writer;
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\NamespaceHelper;
use EdmondsCommerce\DoctrineStaticMeta\Config;
use EdmondsCommerce\DoctrineStaticMeta\Tests\Small\ConfigTest;
use PHPUnit\Framework\TestCase;

/**
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Tests\Entities\EntityTestCreator
 * @small
 */
class EntityTestCreatorTest extends TestCase
{
    private const TEST = '<?php declare(strict_types=1);

namespace EdmondsCommerce\DoctrineStaticMeta\Entities;

use EdmondsCommerce\DoctrineStaticMeta\Entities\AbstractEntityTest;

class TestEntityTest extends AbstractEntityTest
{

}
';

    private const TEST_NESTED = '<?php declare(strict_types=1);

namespace EdmondsCommerce\DoctrineStaticMeta\Entities\Deeply\Nested\Entities;

use EdmondsCommerce\DoctrineStaticMeta\Entities\AbstractEntityTest;

class TestEntityTest extends AbstractEntityTest
{

}
';

    /**
     * @test
     */
    public function itCanCreateANewEntityTest(): void
    {
        $newObjectFqn = 'EdmondsCommerce\\DoctrineStaticMeta\\Entities\\TestEntityTest';
        $file         = $this->getCreator()->createTargetFileObject($newObjectFqn)->getTargetFile();
        $expected     = self::TEST;
        $actual       = $file->getContents();
        self::assertSame($expected, $actual);
    }

    private function getCreator(): EntityTestCreator
    {
        $namespaceHelper = new NamespaceHelper();
        $config          = new Config(ConfigTest::SERVER);

        return new EntityTestCreator(
            new FileFactory($namespaceHelper, $config),
            $namespaceHelper,<commit_msg>fixing small test<commit_after><?php declare(strict_types=1);

namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Small\CodeGeneration\Creation\Tests\Entity;

use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Tests\Entities\EntityTestCreator;
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FileFactory;
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\Factory\FindReplaceFactory;
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\File\Writer;
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\NamespaceHelper;
use EdmondsCommerce\DoctrineStaticMeta\Config;
use EdmondsCommerce\DoctrineStaticMeta\Tests\Small\ConfigTest;
use PHPUnit\Framework\TestCase;

/**
 * @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Creation\Tests\Entities\EntityTestCreator
 * @small
 */
class EntityTestCreatorTest extends TestCase
{
    private const TEST = '<?php declare(strict_types=1);

namespace EdmondsCommerce\DoctrineStaticMeta\Entities;

use EdmondsCommerce\DoctrineStaticMeta\Entities\AbstractEntityTest as TemplateNamespaceAbstractEntityTest;

/**
 * @covers \EdmondsCommerce\DoctrineStaticMeta\Entities\TestEntity
 * @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\DataTransferObjects\TestEntityDto
 */
class TestEntityTest extends TemplateNamespaceAbstractEntityTest
{
}
';

    private const TEST_NESTED = '<?php declare(strict_types=1);

namespace EdmondsCommerce\DoctrineStaticMeta\Entities\Deeply\Nested\Entities;

use EdmondsCommerce\DoctrineStaticMeta\Entities\AbstractEntityTest as TemplateNamespaceAbstractEntityTest;

/**
 * @covers \EdmondsCommerce\DoctrineStaticMeta\Entities\Deeply\Nested\Entities\TestEntity
 * @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\DataTransferObjects\Deeply\Nested\Entities\TestEntityDto
 */
class TestEntityTest extends TemplateNamespaceAbstractEntityTest
{
}
';

    /**
     * @test
     */
    public function itCanCreateANewEntityTest(): void
    {
        $newObjectFqn = 'EdmondsCommerce\\DoctrineStaticMeta\\Entities\\TestEntityTest';
        $file         = $this->getCreator()->createTargetFileObject($newObjectFqn)->getTargetFile();
        $expected     = self::TEST;
        $actual       = $file->getContents();
        self::assertSame($expected, $actual);
    }

    private function getCreator(): EntityTestCreator
    {
        $namespaceHelper = new NamespaceHelper();
        $config          = new Config(ConfigTest::SERVER);

        return new EntityTestCreator(
            new FileFactory($namespaceHelper, $config),
            $namespaceHelper,
{'fraction_non_alphanumeric': 0.09442790301999149, 'fraction_numerical': 0.0012760527435133986, 'mean_word_length': 5.115734720416125, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '3874897', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1347, 'n_words': 183}