<commit_before><?php

declare(strict_types=1);

/**
 * Copyright (c) 2017 <NAME>
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 *
 * @see https://github.com/localheinz/github-changelog
 */

namespace Localheinz\GitHub\ChangeLog\Test\Unit\Util;

use Localheinz\GitHub\ChangeLog\Util\Git;
use Localheinz\GitHub\ChangeLog\Util\GitInterface;
use Localheinz\Test\Util\Helper;
use PHPUnit\Framework;

/**
 * @internal
 */
final class GitTest extends Framework\TestCase
{
    use Helper;

    /**
     * @var string[]
     */
    private $remoteUrls = [];

    protected function tearDown(): void
    {
        if (!\count($this->remoteUrls)) {
            return;
        }

        foreach ($this->remoteUrls as $remoteName => $remoteUrl) {
            \exec(
                \sprintf(
                    'git remote remove %s',
                    $remoteName
                ),
                $output,
                $returnValue
            );
        }

        $this->remoteUrls = null;
    }

    public function testImplementsGitInterface(): void
    {
        $this->assertClassImplementsInterface(GitInterface::class, Git::class);
    }

    public function testRemoteUrlsReturnsRemoteUrls(): void
    {
        \exec(
            'git remote',
            $remoteNames,
            $returnValue
        );

        if (0 !== $returnValue) {
            self::markTestSkipped('Unable to determine existing git remotes.');
        }<commit_msg>Fix: Reset to empty array<commit_after><?php

declare(strict_types=1);

/**
 * Copyright (c) 2017 <NAME>
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 *
 * @see https://github.com/localheinz/github-changelog
 */

namespace Localheinz\GitHub\ChangeLog\Test\Unit\Util;

use Localheinz\GitHub\ChangeLog\Util\Git;
use Localheinz\GitHub\ChangeLog\Util\GitInterface;
use Localheinz\Test\Util\Helper;
use PHPUnit\Framework;

/**
 * @internal
 */
final class GitTest extends Framework\TestCase
{
    use Helper;

    /**
     * @var string[]
     */
    private $remoteUrls = [];

    protected function tearDown(): void
    {
        if (!\count($this->remoteUrls)) {
            return;
        }

        foreach ($this->remoteUrls as $remoteName => $remoteUrl) {
            \exec(
                \sprintf(
                    'git remote remove %s',
                    $remoteName
                ),
                $output,
                $returnValue
            );
        }

        $this->remoteUrls = [];
    }

    public function testImplementsGitInterface(): void
    {
        $this->assertClassImplementsInterface(GitInterface::class, Git::class);
    }

    public function testRemoteUrlsReturnsRemoteUrls(): void
    {
        \exec(
            'git remote',
            $remoteNames,
            $returnValue
        );

        if (0 !== $returnValue) {
            self::markTestSkipped('Unable to determine existing git remotes.');
        }
{'fraction_non_alphanumeric': 0.11468486029889538, 'fraction_numerical': 0.003898635477582846, 'mean_word_length': 1.9922254616132167, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '6857390', 'n_tokens_mistral': 897, 'n_tokens_neox': 851, 'n_words': 195}