Update a batch of failing tests
This commit is contained in:
parent
c19c423568
commit
787346525b
13 changed files with 218 additions and 195 deletions
47
tests/Traits/KnownUuid.php
Normal file
47
tests/Traits/KnownUuid.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Tests\Traits;
|
||||
|
||||
use Mockery as m;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\UuidFactory;
|
||||
|
||||
trait KnownUuid
|
||||
{
|
||||
/**
|
||||
* The known UUID string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $knownUuid = 'ffb5c3a6-ab17-43ab-97f0-8ff37ccd7f5f';
|
||||
|
||||
/**
|
||||
* Setup a factory mock to produce the same UUID whenever called.
|
||||
*/
|
||||
public function setKnownUuidFactory()
|
||||
{
|
||||
$uuid = Uuid::fromString($this->getKnownUuid());
|
||||
$factoryMock = m::mock(UuidFactory::class . '[uuid4]', [
|
||||
'uuid4' => $uuid,
|
||||
]);
|
||||
|
||||
Uuid::setFactory($factoryMock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the known UUID for tests to use.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKnownUuid(): string
|
||||
{
|
||||
return $this->knownUuid;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue