tests/Feature/ProfessionImportTest.php: test recipe without item.
This commit is contained in:
parent
f50227ec19
commit
cc3e0584b5
1 changed files with 77 additions and 0 deletions
|
|
@ -133,4 +133,81 @@ class ProfessionImportTest extends TestCase
|
|||
$this->assertEquals('Felweed', $recipes[1]->reagents[2]->name);
|
||||
$this->assertEquals(2, $recipes[1]->reagents[2]->quantity);
|
||||
}
|
||||
|
||||
public function test_import_recipe_without_craft_item()
|
||||
{
|
||||
$this->seed(\Database\Seeders\ProductionSeeders\ItemSeeder::class);
|
||||
|
||||
$data = (object) [
|
||||
"server" => "Ashbringer",
|
||||
"player" => "Scumbag",
|
||||
"guild" => "Method",
|
||||
"profession" => (object) [
|
||||
"locale" => "enUS",
|
||||
"name" => "Enchanting",
|
||||
"specializationId" => null,
|
||||
"specializationName" => null,
|
||||
"level" => 303,
|
||||
"maxLevel" => 375,
|
||||
"recipes" => [
|
||||
(object) [
|
||||
"description" => "Permanently enchant boots to give +7 Agility.",
|
||||
"name" => "Enchant Boots - Greater Agility",
|
||||
"num" => 0,
|
||||
"categorie" => "none",
|
||||
"items" => [
|
||||
(object) [
|
||||
"color" => "1eff00",
|
||||
"id" => 16203,
|
||||
"num" => 8
|
||||
]
|
||||
],
|
||||
"spellId" => 20023
|
||||
],
|
||||
(object) [
|
||||
"description" => "Transforms a Nexus Crystal into a Small Prismatic Shard.",
|
||||
"name" => "Nexus Transformation",
|
||||
"num" => 1,
|
||||
"categorie" => "none",
|
||||
"items" => [
|
||||
(object) [
|
||||
"color" => "a335ee",
|
||||
"id" => 20725,
|
||||
"num" => 1
|
||||
]
|
||||
],
|
||||
"spellId" => 42613
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
Profession::factory()->create([ 'name' => 'Enchanting' ]);
|
||||
$character = Character::factory()->create([ 'name' => 'Scumbag']);
|
||||
|
||||
ImportProfession::dispatch($character, $data);
|
||||
|
||||
$this->assertEquals('Enchanting', $character->professions[0]->name);
|
||||
$recipes = $character->professions[0]->recipes;
|
||||
|
||||
// Recipe 1
|
||||
$this->assertNull($recipes[0]->craft);
|
||||
|
||||
$this->assertEquals(20023, $recipes[0]->spell->id);
|
||||
$this->assertEquals('Enchant Boots - Greater Agility', $recipes[0]->spell->name);
|
||||
|
||||
$this->assertEquals(16203, $recipes[0]->reagents[0]->external_id);
|
||||
$this->assertEquals('Greater Eternal Essence', $recipes[0]->reagents[0]->name);
|
||||
$this->assertEquals(8, $recipes[0]->reagents[0]->quantity);
|
||||
|
||||
// Recipe 2
|
||||
$this->assertNull($recipes[1]->craft);
|
||||
|
||||
$this->assertEquals(42613, $recipes[1]->spell->id);
|
||||
$this->assertEquals('Nexus Transformation', $recipes[1]->spell->name);
|
||||
|
||||
$this->assertEquals(20725, $recipes[1]->reagents[0]->external_id);
|
||||
$this->assertEquals('Nexus Crystal', $recipes[1]->reagents[0]->name);
|
||||
$this->assertEquals(1, $recipes[1]->reagents[0]->quantity);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue