Fix existing tests
This commit is contained in:
parent
6e02e9491a
commit
159ad3079f
5 changed files with 40 additions and 51 deletions
|
@ -27,17 +27,17 @@ class TemplateUploadServiceTest extends TestCase
|
|||
const JSON_FILE_CONTENTS = '{"test_content": "value"}';
|
||||
|
||||
/**
|
||||
* @var \ZipArchive
|
||||
* @var \ZipArchive|\Mockery\Mock
|
||||
*/
|
||||
protected $archive;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Services\Packs\PackCreationService
|
||||
* @var \Pterodactyl\Services\Packs\PackCreationService|\Mockery\Mock
|
||||
*/
|
||||
protected $creationService;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Http\UploadedFile
|
||||
* @var \Illuminate\Http\UploadedFile|\Mockery\Mock
|
||||
*/
|
||||
protected $file;
|
||||
|
||||
|
@ -70,10 +70,9 @@ class TemplateUploadServiceTest extends TestCase
|
|||
$this->file->shouldReceive('isValid')->withNoArgs()->once()->andReturn(true);
|
||||
$this->file->shouldReceive('getMimeType')->withNoArgs()->twice()->andReturn($mime);
|
||||
$this->file->shouldReceive('getSize')->withNoArgs()->once()->andReturn(128);
|
||||
$this->file->shouldReceive('openFile')->withNoArgs()->once()->andReturnSelf()
|
||||
->shouldReceive('fread')->with(128)->once()->andReturn(self::JSON_FILE_CONTENTS);
|
||||
$this->file->shouldReceive('openFile->fread')->with(128)->once()->andReturn(self::JSON_FILE_CONTENTS);
|
||||
|
||||
$this->creationService->shouldReceive('handle')->with(['test_content' => 'value', 'option_id' => 1])
|
||||
$this->creationService->shouldReceive('handle')->with(['test_content' => 'value', 'egg_id' => 1])
|
||||
->once()->andReturn(factory(Pack::class)->make());
|
||||
|
||||
$this->assertInstanceOf(Pack::class, $this->service->handle(1, $this->file));
|
||||
|
@ -94,7 +93,7 @@ class TemplateUploadServiceTest extends TestCase
|
|||
$this->archive->shouldReceive('locateName')->with('import.json')->once()->andReturn(true);
|
||||
$this->archive->shouldReceive('locateName')->with('archive.tar.gz')->once()->andReturn(true);
|
||||
$this->archive->shouldReceive('getFromName')->with('import.json')->once()->andReturn(self::JSON_FILE_CONTENTS);
|
||||
$this->creationService->shouldReceive('handle')->with(['test_content' => 'value', 'option_id' => 1])
|
||||
$this->creationService->shouldReceive('handle')->with(['test_content' => 'value', 'egg_id' => 1])
|
||||
->once()->andReturn($model);
|
||||
$this->archive->shouldReceive('extractTo')->with(storage_path('app/packs/' . $model->uuid), 'archive.tar.gz')
|
||||
->once()->andReturn(true);
|
||||
|
|
Reference in a new issue