<commit_before><?php

namespace Ramsey\Uuid\Test\Generator;

use Ramsey\Uuid\Generator\RandomLibAdapter;
use Ramsey\Uuid\Test\TestCase;
use Mockery;

class RandomLibAdapterTest extends TestCase
{
    public function tearDown()
    {
        parent::tearDown();
        Mockery::close();
    }

    /**
     * @runInSeparateProcess
     * @preserveGlobalState disabled
     */
    public function testAdapterWithGeneratorDoesNotCreateGenerator()
    {
        $factory = Mockery::mock('overload:RandomLib\Factory');
        $factory->shouldNotReceive('getMediumStrengthGenerator')
                ->getMock();

        $generator = $this->getMockBuilder('RandomLib\Generator')
                          ->disableOriginalConstructor()
                          ->getMock();
        new RandomLibAdapter($generator);
    }

    public function testAdapterWithoutGeneratorGreatesGenerator()
    {
        $factory = Mockery::mock('overload:RandomLib\Factory');
        $factory->shouldReceive('getMediumStrengthGenerator')
                ->once()
                ->getMock();

        new RandomLibAdapter();
    }

    public function testGenerateUsesGenerator()
    {
        $length    = 10;
        $generator = $this->getMockBuilder('RandomLib\Generator')
                          ->disableOriginalConstructor()
                          ->getMock();
        $generator->expects($this->once())
                  ->method('generate')
                  ->with($length);

        $adapter = new RandomLibAdapter($generator);
        $adapter->generate($length);
    }

    public function testGenerateReturnsString()
    {
        $generator = $this->getMockBuilder('RandomLib\Generator')
                          ->disableOriginalConstructor()
                          ->getMock();
        $generator->expects($this->once())
                  ->method('generate')
                  ->willReturn('random-string');

        $adapter = new RandomLibAdapter($generator);
        $result  = $adapter->generate(1);
        $this->assertEquals('random-string', $result);
    }
}<commit_msg>Tests using overload should be run in separate process<commit_after><?php

namespace Ramsey\Uuid\Test\Generator;

use Ramsey\Uuid\Generator\RandomLibAdapter;
use Ramsey\Uuid\Test\TestCase;
use Mockery;

class RandomLibAdapterTest extends TestCase
{
    public function tearDown()
    {
        parent::tearDown();
        Mockery::close();
    }

    /**
     * @runInSeparateProcess
     * @preserveGlobalState disabled
     */
    public function testAdapterWithGeneratorDoesNotCreateGenerator()
    {
        $factory = Mockery::mock('overload:RandomLib\Factory');
        $factory->shouldNotReceive('getMediumStrengthGenerator')
            ->getMock();

        $generator = $this->getMockBuilder('RandomLib\Generator')
            ->disableOriginalConstructor()
            ->getMock();
        new RandomLibAdapter($generator);
    }

    /**
     * @runInSeparateProcess
     * @preserveGlobalState disabled
     */
    public function testAdapterWithoutGeneratorGreatesGenerator()
    {
        $factory = Mockery::mock('overload:RandomLib\Factory');
        $factory->shouldReceive('getMediumStrengthGenerator')
            ->once()
            ->getMock();

        new RandomLibAdapter();
    }

    public function testGenerateUsesGenerator()
    {
        $length = 10;
        $generator = $this->getMockBuilder('RandomLib\Generator')
            ->disableOriginalConstructor()
            ->getMock();
        $generator->expects($this->once())
            ->method('generate')
            ->with($length);

        $adapter = new RandomLibAdapter($generator);
        $adapter->generate($length);
    }

    public function testGenerateReturnsString()
    {
        $generator = $this->getMockBuilder('RandomLib\Generator')
            ->disableOriginalConstructor()
            ->getMock();
        $generator->expects($this->once())
            ->method('generate')
            ->willReturn('random-string');

        $adapter = new RandomLibAdapter($generator);
        $result = $adapter->generate(1);
        $this->assertEquals('random-string', $result);
    }
}
{'fraction_non_alphanumeric': 0.12682809877727164, 'fraction_numerical': 0.0014385039558858787, 'mean_word_length': 2.351004016064257, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '5386234', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1026, 'n_words': 165}