|
134 | 134 | ->and($craftingLookupQuery)->toContain('"key"'); |
135 | 135 | }); |
136 | 136 |
|
| 137 | +it('uses recipe keys when multiple crafting blueprints share the same output name', function (): void { |
| 138 | + $item = Item::factory()->create(); |
| 139 | + |
| 140 | + ItemData::factory() |
| 141 | + ->for($item) |
| 142 | + ->for($this->gameVersion, 'gameVersion') |
| 143 | + ->for($this->manufacturer) |
| 144 | + ->create([ |
| 145 | + 'name' => 'Karna Rifle', |
| 146 | + 'type' => 'Weapon', |
| 147 | + 'class_name' => 'karna_rifle', |
| 148 | + 'classification' => 'FPS.Weapon.Rifle', |
| 149 | + 'data' => ['stdItem' => []], |
| 150 | + ]); |
| 151 | + |
| 152 | + $alphaBlueprint = Blueprint::factory()->create(); |
| 153 | + $betaBlueprint = Blueprint::factory()->create(); |
| 154 | + |
| 155 | + BlueprintData::factory() |
| 156 | + ->for($alphaBlueprint, 'blueprint') |
| 157 | + ->for($this->gameVersion, 'gameVersion') |
| 158 | + ->create([ |
| 159 | + 'key' => 'BP_KARNA_RIFLE_DEFAULT', |
| 160 | + 'output_item_uuid' => $item->uuid, |
| 161 | + 'output_name' => 'Karna Rifle', |
| 162 | + 'is_available_by_default' => false, |
| 163 | + 'data' => [ |
| 164 | + 'output' => [ |
| 165 | + 'uuid' => $item->uuid, |
| 166 | + 'name' => 'Karna Rifle', |
| 167 | + 'class' => 'bp_karna_rifle_default', |
| 168 | + ], |
| 169 | + 'tiers' => [], |
| 170 | + ], |
| 171 | + ]); |
| 172 | + |
| 173 | + BlueprintData::factory() |
| 174 | + ->for($betaBlueprint, 'blueprint') |
| 175 | + ->for($this->gameVersion, 'gameVersion') |
| 176 | + ->create([ |
| 177 | + 'key' => 'BP_KARNA_RIFLE_EVENT', |
| 178 | + 'output_item_uuid' => $item->uuid, |
| 179 | + 'output_name' => 'Karna Rifle', |
| 180 | + 'is_available_by_default' => false, |
| 181 | + 'data' => [ |
| 182 | + 'output' => [ |
| 183 | + 'uuid' => $item->uuid, |
| 184 | + 'name' => 'Karna Rifle', |
| 185 | + 'class' => 'bp_karna_rifle_event', |
| 186 | + ], |
| 187 | + 'tiers' => [], |
| 188 | + ], |
| 189 | + ]); |
| 190 | + |
| 191 | + $response = $this->getJson("/api/items/{$item->uuid}"); |
| 192 | + |
| 193 | + $response->assertSuccessful() |
| 194 | + ->assertJsonPath('data.is_craftable', true) |
| 195 | + ->assertJsonCount(2, 'data.blueprint') |
| 196 | + ->assertJsonPath('data.blueprint.0.uuid', $alphaBlueprint->uuid) |
| 197 | + ->assertJsonPath('data.blueprint.0.name', 'BP_KARNA_RIFLE_DEFAULT') |
| 198 | + ->assertJsonPath('data.blueprint.1.uuid', $betaBlueprint->uuid) |
| 199 | + ->assertJsonPath('data.blueprint.1.name', 'BP_KARNA_RIFLE_EVENT'); |
| 200 | +}); |
| 201 | + |
137 | 202 | it('uses uuid-specific lookup before name or class_name fallbacks', function (): void { |
138 | 203 | $item = Item::factory()->create(); |
139 | 204 | $decoyItem = Item::factory()->create(); |
|
0 commit comments