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

namespace Rector\Tests\Rector;

use Rector\Exception\Rector\RectorNotFoundException;
use Rector\Rector\RectorCollector;
use Rector\Tests\AbstractContainerAwareTestCase;
use Rector\Tests\Rector\RectorCollectorSource\DummyRector;

final class RectorCollectorTest extends AbstractContainerAwareTestCase
{
    /**
     * @var RectorCollector
     */
    private $rectorCollector;

    protected function setUp(): void
    {
        $this->rectorCollector = $this->container->get(RectorCollector::class);
        $this->rectorCollector->addRector(new DummyRector());

        $dummyRector = $this->rectorCollector->getRector(DummyRector::class);
        $this->assertInstanceOf(DummyRector::class, $dummyRector);
    }

    public function testCounts(): void
    {
        $this->assertCount(1, $this->rectorCollector->getRectors());
        $this->assertSame(1, $this->rectorCollector->getRectorCount());
    }

    public function testGetRectors(): void
    {
        $rectors = $this->rectorCollector->getRectors();

        $this->assertArrayHasKey(DummyRector::class, $rectors);
        $this->assertInstanceOf(DummyRector::class, $rectors[DummyRector::class]);
    }

    public function testGetNonExistinsRector(): void
    {
        $this->expectException(RectorNotFoundException::class);
        $this->expectExceptionMessage(sprintf(
            'Rectors class "%s" was not found. Available rectors are: "%s".',
            'MissingRector',
            DummyRector::class
        ));

        $this->rectorCollector->getRector('MissingRector');
    }
}<commit_msg>fix RectorCollectorTest<commit_after><?php declare(strict_types=1);

namespace Rector\Tests\Rector;

use Rector\Exception\Rector\RectorNotFoundException;
use Rector\Rector\RectorCollector;
use Rector\RectorBuilder\BuilderRector;
use Rector\Tests\AbstractContainerAwareTestCase;
use Rector\Tests\Rector\RectorCollectorSource\DummyRector;

final class RectorCollectorTest extends AbstractContainerAwareTestCase
{
    /**
     * @var RectorCollector
     */
    private $rectorCollector;

    protected function setUp(): void
    {
        $this->rectorCollector = $this->container->get(RectorCollector::class);
        $this->rectorCollector->addRector(new DummyRector());

        $dummyRector = $this->rectorCollector->getRector(DummyRector::class);
        $this->assertInstanceOf(DummyRector::class, $dummyRector);
    }

    public function testCounts(): void
    {
        $this->assertCount(2, $this->rectorCollector->getRectors());
        $this->assertSame(2, $this->rectorCollector->getRectorCount());
    }

    public function testGetRectors(): void
    {
        $rectors = $this->rectorCollector->getRectors();

        $this->assertArrayHasKey(DummyRector::class, $rectors);
        $this->assertInstanceOf(DummyRector::class, $rectors[DummyRector::class]);
    }

    public function testGetNonExistinsRector(): void
    {
        $this->expectException(RectorNotFoundException::class);
        $this->expectExceptionMessage(sprintf(
            'Rectors class "%s" was not found. Available rectors are: "%s".',
            'MissingRector',
            implode('", "', [BuilderRector::class, DummyRector::class])
        ));

        $this->rectorCollector->getRector('MissingRector');
    }
}
{'fraction_non_alphanumeric': 0.13060487511284982, 'fraction_numerical': 0.0018055973517905506, 'mean_word_length': 3.8104196816208393, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '4107259', 'n_tokens_mistral': 1017, 'n_tokens_neox': 1005, 'n_words': 145}