Skip to content

Commit c07bc29

Browse files
committed
Update tests
1 parent 9ef2270 commit c07bc29

File tree

9 files changed

+302
-299
lines changed

9 files changed

+302
-299
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# v5.5.1
2+
## Fixes
3+
- Fixed missing cocktail recipes with duplicated names in datapack export
4+
- Fixed total missing ingredients counting when filtering by ingredient
5+
16
# v5.5.0
27
## New
38
- Added images upload support to glass types

app/Http/Controllers/ExportController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function index(Request $request): JsonResource
4848
#[BAO\RateLimitResponse]
4949
public function store(Request $request): ExportResource
5050
{
51-
$bar = Bar::findOrFail($request->post('bar_id'));
51+
$bar = Bar::findOrFail((int) $request->post('bar_id'));
5252

5353
if ($request->user()->cannot('createExport', $bar)) {
5454
abort(403);

composer.lock

Lines changed: 278 additions & 280 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Feature/External/ToDataPackTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,18 @@ public function test_export_contains_files(): void
7979
$this->assertFileExists($unzippedFilesDisk->path($file));
8080
}
8181

82-
$this->assertFileExists($unzippedFilesDisk->path('cocktails/gin-and-tonic/data.json'));
83-
$this->assertFileExists($unzippedFilesDisk->path('cocktails/gin-and-tonic/c-1-img.jpg'));
84-
$this->assertFileExists($unzippedFilesDisk->path('ingredients/jack-daniels/data.json'));
85-
$this->assertFileExists($unzippedFilesDisk->path('ingredients/jack-daniels/i-1-img.png'));
82+
$this->assertFileExists($unzippedFilesDisk->path('cocktails/gin-and-tonic_1/data.json'));
83+
$this->assertFileExists($unzippedFilesDisk->path('cocktails/gin-and-tonic_1/c-1-img.jpg'));
84+
$this->assertFileExists($unzippedFilesDisk->path('ingredients/jack-daniels_1/data.json'));
85+
$this->assertFileExists($unzippedFilesDisk->path('ingredients/jack-daniels_1/i-1-img.png'));
8686

8787
$cocktailExport = [];
88-
if ($cocktailFixture = file_get_contents($unzippedFilesDisk->path('cocktails/gin-and-tonic/data.json'))) {
88+
if ($cocktailFixture = file_get_contents($unzippedFilesDisk->path('cocktails/gin-and-tonic_1/data.json'))) {
8989
$cocktailExport = json_decode($cocktailFixture, true);
9090
}
9191

9292
$ingredientExport = [];
93-
if ($ingredientFixture = file_get_contents($unzippedFilesDisk->path('ingredients/jack-daniels/data.json'))) {
93+
if ($ingredientFixture = file_get_contents($unzippedFilesDisk->path('ingredients/jack-daniels_1/data.json'))) {
9494
$ingredientExport = json_decode($ingredientFixture, true);
9595
}
9696

tests/Feature/External/ToRecipeTypeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public function test_default_export_contains_schema_files(): void
6868
$zip->close();
6969

7070
$this->assertFileExists($unzippedFilesDisk->path('_meta.json'));
71-
$this->assertFileExists($unzippedFilesDisk->path('cocktails/gin-and-tonic/recipe.json'));
72-
$this->assertFileExists($unzippedFilesDisk->path('cocktails/gin-and-tonic/c-1-img.jpg'));
71+
$this->assertFileExists($unzippedFilesDisk->path('cocktails/gin-and-tonic_1/recipe.json'));
72+
$this->assertFileExists($unzippedFilesDisk->path('cocktails/gin-and-tonic_1/c-1-img.jpg'));
7373
}
7474

7575
/**

tests/Feature/Services/IngredientServiceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
use Tests\TestCase;
88
use Kami\Cocktail\Models\Ingredient;
9+
use Kami\Cocktail\Models\UserIngredient;
910
use Kami\Cocktail\Models\ComplexIngredient;
1011
use Kami\Cocktail\Services\IngredientService;
1112
use Illuminate\Foundation\Testing\RefreshDatabase;
12-
use Kami\Cocktail\Models\UserIngredient;
1313

1414
class IngredientServiceTest extends TestCase
1515
{

tests/fixtures/external/recipe.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"recipe": {
3-
"_id": "gin-and-tonic",
3+
"_id": "gin-and-tonic_1",
44
"name": "Gin and Tonic",
55
"instructions": "Cocktail instructions go here",
66
"created_at": "2020-01-01T12:00:00+00:00",
@@ -23,7 +23,7 @@
2323
],
2424
"ingredients": [
2525
{
26-
"_id": "gin",
26+
"_id": "gin_1",
2727
"amount": 45,
2828
"units": "ml",
2929
"optional": false,
@@ -37,7 +37,7 @@
3737
},
3838
"ingredients": [
3939
{
40-
"_id": "gin",
40+
"_id": "gin_1",
4141
"name": "Gin",
4242
"strength": 40,
4343
"description": "Test description",

tests/fixtures/external/recipe.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<draft2>
33
<recipe>
4-
<_id>gin-and-tonic</_id>
4+
<_id>gin-and-tonic_1</_id>
55
<name>Gin and Tonic</name>
66
<instructions>Cocktail instructions go here</instructions>
77
<created_at>2020-01-01T12:00:00+00:00</created_at>
@@ -21,7 +21,7 @@
2121
<copyright>Exported copyright</copyright>
2222
</images>
2323
<ingredients>
24-
<_id>gin</_id>
24+
<_id>gin_1</_id>
2525
<amount>45</amount>
2626
<units>ml</units>
2727
<optional></optional>
@@ -33,7 +33,7 @@
3333
</ingredients>
3434
</recipe>
3535
<ingredients>
36-
<_id>gin</_id>
36+
<_id>gin_1</_id>
3737
<name>Gin</name>
3838
<strength>40</strength>
3939
<description>Test description</description>

tests/fixtures/external/recipe.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
recipe:
2-
_id: gin-and-tonic
2+
_id: gin-and-tonic_1
33
name: 'Gin and Tonic'
44
instructions: 'Cocktail instructions go here'
55
created_at: '2020-01-01T12:00:00+00:00'
@@ -20,7 +20,7 @@ recipe:
2020
copyright: 'Exported copyright'
2121
ingredients:
2222
-
23-
_id: gin
23+
_id: gin_1
2424
amount: 45.0
2525
units: ml
2626
optional: false
@@ -31,7 +31,7 @@ recipe:
3131
sort: 1
3232
ingredients:
3333
-
34-
_id: gin
34+
_id: gin_1
3535
name: Gin
3636
strength: 40.0
3737
description: 'Test description'

0 commit comments

Comments
 (0)