-
+
+
+ {{ __('Download this') }}
+ {{ __('addon') }}
+
+
+
+
+ {{ __('Import string') }}
+
+
+
+
+
+
+
diff --git a/resources/views/components/profession-import-form.blade.php b/resources/views/components/profession-import-form.blade.php
deleted file mode 100644
index 828638b..0000000
--- a/resources/views/components/profession-import-form.blade.php
+++ /dev/null
@@ -1,17 +0,0 @@
-
- {{ __("Important") }}!
- {{ __('Download this') }}
- {{ __('addon') }}
- {{ __('to generate the import string') }}
-
-
-
-
- {{ __('Import string') }}
-
-
-
-
-
-
-
diff --git a/resources/views/item/show.blade.php b/resources/views/item/show.blade.php
index 4cdd7fb..de1e7c4 100644
--- a/resources/views/item/show.blade.php
+++ b/resources/views/item/show.blade.php
@@ -3,43 +3,6 @@
{{ __('Item') }} - {{ $item->name }}
-
- {{ $item->name }}
-
- @if (count($item->recipes) > 0)
-
-
- {{ __('Created by') }}
-
-
- @foreach($item->recipes as $recipe)
- -
- @if ($recipe->spell_id)
- {{ $recipe->name }}
- @else
- {{ $recipe->name }}
- @endif
-
- @endforeach
-
-
- @endif
-
- @if (count($item->reagent_for) > 0)
-
-
- {{ __('Reagent for') }}
-
-
-
- @foreach($item->reagent_for as $recipe)
-
- @endforeach
-
-
- @endif
-
-
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
index 95d2f86..e98d999 100644
--- a/resources/views/layouts/app.blade.php
+++ b/resources/views/layouts/app.blade.php
@@ -12,7 +12,7 @@
@if (isset($page_links))
-
+
{{ $page_links }}
@endif
diff --git a/resources/views/profession/create.blade.php b/resources/views/profession/create.blade.php
deleted file mode 100644
index 609bac5..0000000
--- a/resources/views/profession/create.blade.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- {{ __('Import Profession') }}
-
-
-
-
-
-
-
-
diff --git a/resources/views/profile/index.blade.php b/resources/views/profile/index.blade.php
index e50d6e8..49e42b4 100644
--- a/resources/views/profile/index.blade.php
+++ b/resources/views/profile/index.blade.php
@@ -16,14 +16,10 @@
{{ __('Characters') }}
-
+
{{ __('Add character') }}
-
-
- {{ __('Import profession') }}
-
diff --git a/resources/views/recipe/show.blade.php b/resources/views/recipe/show.blade.php
index aa0f639..9518937 100644
--- a/resources/views/recipe/show.blade.php
+++ b/resources/views/recipe/show.blade.php
@@ -9,10 +9,6 @@
- @if ($recipe->description)
-
{{ $recipe->description }}
- @endif
-
@if ($recipe->craft)
diff --git a/resources/views/user/show.blade.php b/resources/views/user/show.blade.php
index 97eff3f..9054c06 100644
--- a/resources/views/user/show.blade.php
+++ b/resources/views/user/show.blade.php
@@ -10,8 +10,12 @@
@if ($user->characters->count())
- @foreach($user->characters as $character)
-
+ @if ($user->main_character)
+
+ @endif
+
+ @foreach($user->alt_characters as $character)
+
@endforeach
@else
diff --git a/routes/web.php b/routes/web.php
index 8993662..d931034 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -82,12 +82,6 @@ Route::prefix('items')->name('item.')->group(function () {
// ----------------------------
Route::middleware(['auth'])->group(function() {
- // Profession
- Route::prefix('profession')->name('profession.')->group(function() {
- Route::get('/create', [ProfessionController::class, 'create'])->name('create');
- Route::post('/', [ProfessionController::class, 'store'])->name('store');
- });
-
Route::prefix('profile')->name('profile.')->group(function () {
Route::get('/', [ProfileController::class, 'index'])->name('index');
Route::get('/edit', [ProfileController::class, 'edit'])->name('edit');
diff --git a/tests/Feature/ProfessionImport/BasicTest.php b/tests/Feature/ProfessionImport/BasicTest.php
index 1f15dd5..c98fc34 100644
--- a/tests/Feature/ProfessionImport/BasicTest.php
+++ b/tests/Feature/ProfessionImport/BasicTest.php
@@ -11,6 +11,7 @@ use App\Models\Recipe;
use App\Models\Spell;
use App\Jobs\ImportProfession;
+use App\ProfessionImport\InvalidCharacterException;
use App\ProfessionImport\InvalidProfessionException;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -95,7 +96,7 @@ class BasicTest extends TestCase
Profession::factory()->create([ 'name' => 'Alchemy' ]);
$character = Character::factory()->create([ 'name' => 'Superduper']);
- ImportProfession::dispatch($data, $character->user, $character);
+ ImportProfession::dispatch($character, $data);
$this->assertEquals('Alchemy', $character->professions[0]->name);
$recipes = $character->professions[0]->recipes;
@@ -130,13 +131,35 @@ class BasicTest extends TestCase
$this->assertEquals('Imbued Vial', $recipes[1]->reagents[0]->name);
$this->assertEquals(1, $recipes[1]->reagents[0]->quantity);
- $this->assertEquals(22785, $recipes[1]->reagents[1]->external_id);
- $this->assertEquals('Felweed', $recipes[1]->reagents[1]->name);
- $this->assertEquals(2, $recipes[1]->reagents[1]->quantity);
+ $this->assertEquals(22789, $recipes[1]->reagents[1]->external_id);
+ $this->assertEquals('Terocone', $recipes[1]->reagents[1]->name);
+ $this->assertEquals(1, $recipes[1]->reagents[1]->quantity);
- $this->assertEquals(22789, $recipes[1]->reagents[2]->external_id);
- $this->assertEquals('Terocone', $recipes[1]->reagents[2]->name);
- $this->assertEquals(1, $recipes[1]->reagents[2]->quantity);
+ $this->assertEquals(22785, $recipes[1]->reagents[2]->external_id);
+ $this->assertEquals('Felweed', $recipes[1]->reagents[2]->name);
+ $this->assertEquals(2, $recipes[1]->reagents[2]->quantity);
+ }
+
+ public function test_wrong_character_name()
+ {
+ Profession::factory()->create([ 'name' => 'Alchemy' ]);
+ $character = Character::factory()->create([ 'name' => 'Actualname']);
+
+ $data = (object) [
+ "server" => "Ashbringer",
+ "player" => "Wrongname",
+ "guild" => "Flat Azeroth Research Team",
+ "profession" => (object) [
+ "name" => "Alchemy",
+ "level" => 375,
+ "maxLevel" => 375,
+ "recipes" => []
+ ]
+ ];
+
+ $this->expectException(InvalidCharacterException::class);
+
+ ImportProfession::dispatch($character, $data);
}
public function test_invalid_profession()
@@ -147,7 +170,7 @@ class BasicTest extends TestCase
$character = Character::factory()->create();
$data = (object) [
- "server" => "Sulfuron",
+ "server" => "Ashbringer",
"player" => $character->name,
"guild" => "Futuramalama",
"profession" => (object) [
@@ -160,6 +183,6 @@ class BasicTest extends TestCase
$this->expectException(InvalidProfessionException::class);
- ImportProfession::dispatch($data, $character->user, $character);
+ ImportProfession::dispatch($character, $data);
}
}
diff --git a/tests/Feature/ProfessionImport/CharacterTest.php b/tests/Feature/ProfessionImport/CharacterTest.php
deleted file mode 100644
index 93054fa..0000000
--- a/tests/Feature/ProfessionImport/CharacterTest.php
+++ /dev/null
@@ -1,152 +0,0 @@
-create([ 'name' => 'Alchemy' ]);
- $character = Character::factory()->create([ 'name' => 'Charfound']);
-
- $data = (object) [
- "server" => "Darkshore",
- "player" => "Charfound",
- "guild" => "ABOBA",
- "profession" => (object) [
- "name" => "Alchemy",
- "level" => 375,
- "maxLevel" => 375,
- "recipes" => [
- (object) [
- "name" => "Elixir of Major Defense",
- "color" => "ffffff",
- "id" => 22834,
- "num" => 1,
- "categorie" => "Elixir",
- "items" => [
- (object) [
- "name" => "Ancient Lichen",
- "color" => "ffffff",
- "num" => 3,
- "id" => 22790
- ],
- (object) [
- "name" => "Terocone",
- "color" => "ffffff",
- "num" => 1,
- "id" => 22789
- ],
- (object) [
- "name" => "Imbued Vial",
- "color" => "ffffff",
- "num" => 1,
- "id" => 18256
- ],
- ],
- "spellId" => 28557
- ],
- ]
- ]
- ];
-
- ImportProfession::dispatch($data, $character->user);
-
- $this->assertEquals('Alchemy', $character->professions[0]->name);
- $recipes = $character->professions[0]->recipes;
-
- $this->assertEquals(22834, $recipes[0]->craft->external_id);
- $this->assertEquals('Elixir of Major Defense', $recipes[0]->craft->name);
-
- $this->assertEquals(28557, $recipes[0]->spell->id);
- $this->assertEquals('Elixir of Major Defense', $recipes[0]->spell->name);
-
- $this->assertEquals(22790, $recipes[0]->reagents[0]->external_id);
- $this->assertEquals('Ancient Lichen', $recipes[0]->reagents[0]->name);
- $this->assertEquals(3, $recipes[0]->reagents[0]->quantity);
-
- $this->assertEquals(18256, $recipes[0]->reagents[1]->external_id);
- $this->assertEquals('Imbued Vial', $recipes[0]->reagents[1]->name);
- $this->assertEquals(1, $recipes[0]->reagents[1]->quantity);
-
- $this->assertEquals(22789, $recipes[0]->reagents[2]->external_id);
- $this->assertEquals('Terocone', $recipes[0]->reagents[2]->name);
- $this->assertEquals(1, $recipes[0]->reagents[2]->quantity);
- }
-
- public function test_character_not_found()
- {
- $character = Character::factory()->create([ 'name' => 'Findme']);
-
- $data = (object) [
- "server" => "Ashbringer",
- "player" => "Anotherdude",
- "guild" => "Raiders of the Last Mark",
- "profession" => (object) [
- "name" => "Alchemy",
- "level" => 375,
- "maxLevel" => 375,
- "recipes" => []
- ]
- ];
-
- $this->expectException(InvalidCharacterException::class);
-
- ImportProfession::dispatch($data, $character->user);
- }
-
- public function test_other_users_characters_is_not_found()
- {
- $character = Character::factory()->create([ 'name' => 'Otherchar']);
-
- $data = (object) [
- "server" => "Rattlegore",
- "player" => "Otherchar",
- "guild" => "The A-Team",
- "profession" => (object) [
- "name" => "Alchemy",
- "level" => 375,
- "maxLevel" => 375,
- "recipes" => []
- ]
- ];
-
- $this->expectException(InvalidCharacterException::class);
-
- ImportProfession::dispatch($data, User::factory()->create());
- }
-
- public function test_character_is_not_the_same_as_imported_name()
- {
- $character = Character::factory()->create([ 'name' => 'Actualname']);
-
- $data = (object) [
- "server" => "Benediction",
- "player" => "Wrongname",
- "guild" => "Spaceballs",
- "profession" => (object) [
- "name" => "Alchemy",
- "level" => 375,
- "maxLevel" => 375,
- "recipes" => []
- ]
- ];
-
- $this->expectException(InvalidCharacterException::class);
-
- ImportProfession::dispatch($data, $character->user, $character);
- }
-}
diff --git a/tests/Feature/ProfessionImport/RecipesTest.php b/tests/Feature/ProfessionImport/RecipesTest.php
index b9604bd..f958cc0 100644
--- a/tests/Feature/ProfessionImport/RecipesTest.php
+++ b/tests/Feature/ProfessionImport/RecipesTest.php
@@ -22,7 +22,7 @@ class RecipesTest extends TestCase
$this->seed(\Database\Seeders\ProductionSeeders\ItemSeeder::class);
$data = (object) [
- "server" => "Whitemane",
+ "server" => "Ashbringer",
"player" => "Scumbag",
"guild" => "Method",
"profession" => (object) [
@@ -68,7 +68,7 @@ class RecipesTest extends TestCase
Profession::factory()->create([ 'name' => 'Enchanting' ]);
$character = Character::factory()->create([ 'name' => 'Scumbag']);
- ImportProfession::dispatch($data, $character->user, $character);
+ ImportProfession::dispatch($character, $data);
$this->assertEquals('Enchanting', $character->professions[0]->name);
$recipes = $character->professions[0]->recipes;
@@ -106,9 +106,7 @@ class RecipesTest extends TestCase
->create(['spell_id' => null]);
$data = (object) [
- "server" => "Mograine",
"player" => $character->name,
- "guild" => "Odyssey",
"profession" => (object) [
"name" => $profession->name,
"level" => 375,
@@ -125,7 +123,7 @@ class RecipesTest extends TestCase
]
];
- ImportProfession::dispatch($data, $character->user, $character);
+ ImportProfession::dispatch($character, $data);
$this->assertEquals(1, Recipe::count());
$this->assertDatabaseHas('recipes', [
diff --git a/tests/Feature/ProfessionImport/SpecializationTest.php b/tests/Feature/ProfessionImport/SpecializationTest.php
index 55d02c9..b0b2df8 100644
--- a/tests/Feature/ProfessionImport/SpecializationTest.php
+++ b/tests/Feature/ProfessionImport/SpecializationTest.php
@@ -22,9 +22,7 @@ class SpecializationTest extends TestCase
$specialization = Spell::factory()->create(['id' => 28672, 'name' => 'Transmutation Master']);
$data = (object) [
- "server" => "Firemaw",
"player" => $character->name,
- "guild" => "Salad Bakers",
"profession" => (object) [
"name" => $profession->name,
"specializationId" => 28672,
@@ -34,7 +32,7 @@ class SpecializationTest extends TestCase
]
];
- ImportProfession::dispatch($data, $character->user, $character);
+ ImportProfession::dispatch($character, $data);
$this->assertNotNull($character->professions[0]->specialization, "specalization was not imported");
$this->assertEquals(28672, $character->professions[0]->specialization->id);
@@ -49,9 +47,7 @@ class SpecializationTest extends TestCase
$profession = Profession::factory()->create([ 'name' => 'Carpenter' ]);
$data = (object) [
- "server" => "Loatheb",
"player" => $character->name,
- "guild" => "Progress",
"profession" => (object) [
"name" => $profession->name,
"level" => 375,
@@ -59,7 +55,7 @@ class SpecializationTest extends TestCase
]
];
- ImportProfession::dispatch($data, $character->user, $character);
+ ImportProfession::dispatch($character, $data);
$this->assertNull($character->professions[0]->specialization);
}
diff --git a/tests/Feature/ProfessionTest.php b/tests/Feature/ProfessionTest.php
deleted file mode 100644
index b70e431..0000000
--- a/tests/Feature/ProfessionTest.php
+++ /dev/null
@@ -1,89 +0,0 @@
-get(route('profession.create'));
-
- $response->assertRedirect(route('auth.login'));
- }
-
- public function test_user_is_allowed_to_create_profession()
- {
- $user = User::factory()->create();
-
- $response = $this->actingAs($user)
- ->get(route('profession.create'));
-
- $response->assertStatus(200); // OK
- }
-
- public function test_user_is_allowed_to_import_profession_for_their_own_character()
- {
- Profession::factory()->create(['name' => 'Influencer']);
- $user = User::factory()->create();
- $character = Character::factory()
- ->for($user)
- ->create(['name' => 'Rambone']);
-
- $data = '{
- "server":"Bigglesworth",
- "player":"Rambone",
- "guild":"First Blood",
- "profession": {
- "locale":"enUS",
- "name":"Influencer",
- "specializationId":null,
- "specializationName":null,
- "level":375,
- "maxLevel":375,
- "recipes": []
- }
- }';
-
- $response = $this->actingAs($user)
- ->post(route('profession.store'), ['data' => $data]);
-
- $response->assertSessionHas(['success' => "Profession imported!"]);
- }
-
- public function test_user_is_not_allowed_to_import_profession_for_someone_elses_character()
- {
- Profession::factory()->create(['name' => 'Alchemy']);
- $user = User::factory()->create();
- $character = Character::factory()->create(['name' => 'Angus']);
-
- $data = '{
- "server":"Deviate Delight",
- "player":"Angus",
- "guild":"Phoenix",
- "profession": {
- "locale":"enUS",
- "name":"Alchemy",
- "specializationId":null,
- "specializationName":null,
- "level":375,
- "maxLevel":375,
- "recipes": []
- }
- }';
-
- $response = $this->actingAs($user)
- ->post(route('profession.store'), ['data' => $data]);
-
- $response->assertSessionHas(['error' => 'Could not find character "Angus"']);
- }
-}