<commit_before><?php

namespace Droath\ProjectX\Tests;

use Droath\ProjectX\Filesystem\YamlFilesystem;
use PHPUnit\Framework\TestCase;
use org\bovigo\vfs\vfsStream;

/**
 * Define Project-X test base class.
 */
abstract class TestBase extends TestCase
{
    /**
     * Project-X directory.
     *
     * @var \org\bovigo\vfs\vfsStreamDirectory
     */
    protected $projectDir;

    /**
     * Project-X root URL.
     *
     * @var string
     */
    protected $projectRoot;

    /**
     * Project-X file name.
     *
     * @var string
     */
    protected $projectFileName = 'project-x.yml';

    /**
     * {@inheritdoc}
     */
    public static function setUpBeforeClass()
    {
        if (!defined('APP_ROOT')) {
            define('APP_ROOT', '.');
        }
    }

    /**
     * {@inheritdoc}
     */
    public function setUp()
    {
        $this->projectDir = vfsStream::setup('root');
        $this->projectRoot = vfsStream::url('root');

        (new YamlFilesystem(
            $this->getProjectXFileContents(),
            $this->projectRoot
        ))
        ->save($this->projectFileName);
    }

    /**
     * Get Project-X file contents fixture.
     *
     * @return array
     */
    protected function getProjectXFileContents()
    {
        return [
            'name' => 'Project-X Test',
            'type' => 'drupal',
            'engine' => 'docker',
            'host' => [
                'name' => 'local.project-x-test.com',
                'open_on_startup' => 'true',
            ],
        ];
    }

    /**
     * Get Project-X file path.
     *
     * @return string
     */
    protected function getProjectXFilePath()
    {
        return $this->getProjectFileUrl($this->projectFileName);
    }
<commit_msg>GH-5: Update the test base class to include Project-X local configuration.<commit_after><?php

namespace Droath\ProjectX\Tests;

use Droath\ProjectX\Filesystem\YamlFilesystem;
use PHPUnit\Framework\TestCase;
use org\bovigo\vfs\vfsStream;

/**
 * Define Project-X test base class.
 */
abstract class TestBase extends TestCase
{
    /**
     * Project-X directory.
     *
     * @var \org\bovigo\vfs\vfsStreamDirectory
     */
    protected $projectDir;

    /**
     * Project-X root URL.
     *
     * @var string
     */
    protected $projectRoot;

    /**
     * Project-X file name.
     *
     * @var string
     */
    protected $projectFileName = 'project-x.yml';

    /**
     * Project-X local file name.
     *
     * @var string
     */
    protected $projectLocalFileName = 'project-x.local.yml';

    /**
     * {@inheritdoc}
     */
    public static function setUpBeforeClass()
    {
        if (!defined('APP_ROOT')) {
            define('APP_ROOT', '.');
        }
    }

    /**
     * {@inheritdoc}
     */
    public function setUp()
    {
        $this->projectDir = vfsStream::setup('root');
        $this->projectRoot = vfsStream::url('root');

        $this->addProjectXConfigToRoot();
    }

    /**
     * Add Project-X config to project root.
     */
    protected function addProjectXConfigToRoot()
    {
        (new YamlFilesystem(
            $this->getProjectXFileContents(),
            $this->projectRoot
        ))
        ->save($this->projectFileName);

        return $this;
    }

    /**
     * Add Project-X local config to project root.
     */
    protected function addProjecXLocalConfigToRoot()
    {
        (new YamlFilesystem(
            $this->getprojectXLocalFileContents(),
            $this->projectRoot
        ))
        ->save($this->projectLocalFileName);

        return $this;
    }

    /**
     * Get Project-X file contents fixture.
     *
     * @return array
     */
    protected function getProjectXFileContents()
    {
        return [
            'name' => 'Project-X Test',
            'type' => 'drupal',
            'engine' => 'docker',
            'host' => [
                'name' => 'local.project-x-test.com',
                'open_on_startup' => 'true',
            ],
        ];
    }

    /**
     * The project-X local file contents fixture.
     *
     * @return array
     */
    protected function getprojectXLocalFileContents()
    {
        return [
            'name' => 'Project-X Local',
            'type' => 'drupal',
            'host' => [
                'open_on_startup' => 'false',
            ],
        ];
    }

    /**
     * Get Project-X file path.
     *
     * @return string
     */
    protected function getProjectXFilePath()
    {
        return $this->getProjectFileUrl($this->projectFileName);
    }

{'fraction_non_alphanumeric': 0.13778751369112816, 'fraction_numerical': 0.0002190580503833516, 'mean_word_length': 1.7097922848664688, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 40, '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': '3555963', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1352, 'n_words': 258}