77 * https://opensource.org/licenses/MIT
88 */
99
10- namespace Tests \Unit \Services \Services \Sharing ;
10+ namespace Tests \Unit \Services \Eggs \Sharing ;
1111
1212use Mockery as m ;
1313use Carbon \Carbon ;
1414use Tests \TestCase ;
1515use Pterodactyl \Models \Egg ;
1616use Pterodactyl \Models \EggVariable ;
1717use Tests \Assertions \NestedObjectAssertionsTrait ;
18+ use Pterodactyl \Services \Eggs \Sharing \EggExporterService ;
1819use Pterodactyl \Contracts \Repository \EggRepositoryInterface ;
19- use Pterodactyl \Services \Services \Sharing \ServiceOptionExporterService ;
2020
21- class ServiceOptionExporterServiceTest extends TestCase
21+ class EggExporterServiceTest extends TestCase
2222{
2323 use NestedObjectAssertionsTrait;
2424
@@ -33,7 +33,7 @@ class ServiceOptionExporterServiceTest extends TestCase
3333 protected $ repository ;
3434
3535 /**
36- * @var \Pterodactyl\Services\Services \Sharing\ServiceOptionExporterService
36+ * @var \Pterodactyl\Services\Eggs \Sharing\EggExporterService
3737 */
3838 protected $ service ;
3939
@@ -48,26 +48,28 @@ public function setUp()
4848 $ this ->carbon = new Carbon ();
4949 $ this ->repository = m::mock (EggRepositoryInterface::class);
5050
51- $ this ->service = new ServiceOptionExporterService ( $ this -> carbon , $ this ->repository );
51+ $ this ->service = new EggExporterService ( $ this ->repository );
5252 }
5353
5454 /**
5555 * Test that a JSON structure is returned.
5656 */
5757 public function testJsonStructureIsExported ()
5858 {
59- $ option = factory (Egg::class)->make ();
60- $ option ->variables = collect ([$ variable = factory (EggVariable::class)->make ()]);
59+ $ egg = factory (Egg::class)->make ();
60+ $ egg ->variables = collect ([$ variable = factory (EggVariable::class)->make ()]);
6161
62- $ this ->repository ->shouldReceive ('getWithExportAttributes ' )->with ($ option ->id )->once ()->andReturn ($ option );
62+ $ this ->repository ->shouldReceive ('getWithExportAttributes ' )->with ($ egg ->id )->once ()->andReturn ($ egg );
6363
64- $ response = $ this ->service ->handle ($ option ->id );
64+ $ response = $ this ->service ->handle ($ egg ->id );
6565 $ this ->assertNotEmpty ($ response );
6666
6767 $ data = json_decode ($ response );
6868 $ this ->assertEquals (JSON_ERROR_NONE , json_last_error ());
6969 $ this ->assertObjectHasNestedAttribute ('meta.version ' , $ data );
7070 $ this ->assertObjectNestedValueEquals ('meta.version ' , 'PTDL_v1 ' , $ data );
71+ $ this ->assertObjectHasNestedAttribute ('author ' , $ data );
72+ $ this ->assertObjectNestedValueEquals ('author ' , $ egg ->author , $ data );
7173 $ this ->assertObjectHasNestedAttribute ('exported_at ' , $ data );
7274 $ this ->assertObjectNestedValueEquals ('exported_at ' , Carbon::now ()->toIso8601String (), $ data );
7375 $ this ->assertObjectHasNestedAttribute ('scripts.installation.script ' , $ data );
0 commit comments