OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
ramsey
/
uuid
/
tests
/
Generator
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/12/2024 10:36:11 AM
rwxr-xr-x
📄
CombGeneratorTest.php
4.65 KB
08/12/2024 10:34:38 AM
rw-r--r--
📄
DceSecurityGeneratorTest.php
11.4 KB
08/12/2024 10:34:38 AM
rw-r--r--
📄
DefaultNameGeneratorTest.php
2.48 KB
08/12/2024 10:34:38 AM
rw-r--r--
📄
DefaultTimeGeneratorTest.php
6.88 KB
08/12/2024 10:34:38 AM
rw-r--r--
📄
NameGeneratorFactoryTest.php
464 bytes
08/12/2024 10:34:38 AM
rw-r--r--
📄
PeclUuidNameGeneratorTest.php
3.48 KB
08/12/2024 10:34:38 AM
rw-r--r--
📄
PeclUuidRandomGeneratorTest.php
757 bytes
08/12/2024 10:34:38 AM
rw-r--r--
📄
PeclUuidTimeGeneratorTest.php
747 bytes
08/12/2024 10:34:38 AM
rw-r--r--
📄
RandomBytesGeneratorTest.php
1.89 KB
08/12/2024 10:34:38 AM
rw-r--r--
📄
RandomGeneratorFactoryTest.php
498 bytes
08/12/2024 10:34:38 AM
rw-r--r--
📄
RandomLibAdapterTest.php
2.28 KB
08/12/2024 10:34:38 AM
rw-r--r--
📄
TimeGeneratorFactoryTest.php
1.21 KB
08/12/2024 10:34:38 AM
rw-r--r--
📄
UnixTimeGeneratorTest.php
7.36 KB
08/12/2024 10:34:38 AM
rw-r--r--
Editing: RandomLibAdapterTest.php
Close
<?php declare(strict_types=1); namespace Ramsey\Uuid\Test\Generator; use Mockery; use Mockery\MockInterface; use Ramsey\Uuid\Generator\RandomLibAdapter; use Ramsey\Uuid\Test\TestCase; use RandomLib\Factory as RandomLibFactory; use RandomLib\Generator; class RandomLibAdapterTest extends TestCase { /** * @runInSeparateProcess * @preserveGlobalState disabled */ public function testAdapterWithGeneratorDoesNotCreateGenerator(): void { $factory = Mockery::mock('overload:' . RandomLibFactory::class); $factory->shouldNotReceive('getHighStrengthGenerator'); $generator = $this->getMockBuilder(Generator::class) ->disableOriginalConstructor() ->getMock(); $this->assertInstanceOf(RandomLibAdapter::class, new RandomLibAdapter($generator)); } /** * @runInSeparateProcess * @preserveGlobalState disabled */ public function testAdapterWithoutGeneratorGreatesGenerator(): void { $generator = Mockery::mock(Generator::class); /** @var RandomLibFactory&MockInterface $factory */ $factory = Mockery::mock('overload:' . RandomLibFactory::class); $factory->expects()->getHighStrengthGenerator()->andReturns($generator); $this->assertInstanceOf(RandomLibAdapter::class, new RandomLibAdapter()); } public function testGenerateUsesGenerator(): void { $length = 10; $generator = $this->getMockBuilder(Generator::class) ->disableOriginalConstructor() ->getMock(); $generator->expects($this->once()) ->method('generate') ->with($length) ->willReturn('foo'); $adapter = new RandomLibAdapter($generator); $adapter->generate($length); } public function testGenerateReturnsString(): void { $generator = $this->getMockBuilder(Generator::class) ->disableOriginalConstructor() ->getMock(); $generator->expects($this->once()) ->method('generate') ->willReturn('random-string'); $adapter = new RandomLibAdapter($generator); $result = $adapter->generate(1); $this->assertSame('random-string', $result); } }