Merge branch 'eatvio-main'

This commit is contained in:
2023-12-25 15:01:28 +03:00
33 changed files with 10160 additions and 335 deletions

View File

@@ -17,6 +17,7 @@ class DietController extends Controller
*/
public function index(Request $request)
{
$hasTypes = [];
if ($request->has('author')) {
$author = $request->get('author');
$user = User::find($author);

769
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,25 +13,33 @@
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/typography": "^0.5.0",
"alpinejs": "^3.0.6",
"autoprefixer": "^10.4.7",
"autoprefixer": "^10.4.16",
"axios": "^0.25",
"css-loader": "^6.8.1",
"html-webpack-plugin": "^5.6.0",
"laravel-echo": "^1.15.0",
"laravel-mix": "^6.0.49",
"less": "^4.1.3",
"less-loader": "^11.0.0",
"lodash": "^4.17.19",
"postcss": "^8.4.14",
"postcss": "^8.4.32",
"postcss-import": "^14.0.1",
"postcss-loader": "^7.3.3",
"pusher-js": "^8.0.1",
"resolve-url-loader": "^5.0.0",
"sass": "^1.69.5",
"sass-loader": "^12.6.0",
"tailwindcss": "^3.3.3"
"style-loader": "^3.3.3",
"tailwindcss": "^3.4.0",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.4.0",
"@popperjs/core": "^2.11.8",
"@sentry/browser": "^7.40.0",
"@tailwindcss/ui": "^0.7.2",
"apexcharts": "^3.35.2",
"sass": "^1.63.2"
"bootstrap": "^5.3.2"
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,9 @@
/*!
* Bootstrap v5.3.2 (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Pusher JavaScript Library v8.3.0
* https://pusher.com/

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=87ac2e2e11714dbdb3a90de921976185",
"/css/app.css": "/css/app.css?id=ade72e00a2458d3a8b45d3643cf50e3b"
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
}

View File

@@ -1,6 +1,6 @@
/* @tailwind base;
@tailwind base;
@tailwind components;
@tailwind utilities; */
@tailwind utilities;
[x-cloak] {
display: none;

View File

@@ -1,5 +1,10 @@
window._ = require("lodash");
import * as Popper from '@popperjs/core'
window.Popper = Popper
import 'bootstrap'
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the

3
resources/sass/app.scss Normal file
View File

@@ -0,0 +1,3 @@
@import '~bootstrap/scss/bootstrap';

View File

@@ -9,7 +9,6 @@
@endisset
@endsection
@push('css_head')
{{-- <script src="/js/build/ckeditor.js" defer></script> --}}
<script src="/js/ckeditor.js"></script>
<script src="https://unpkg.com/taggle/src/taggle.js" defer></script>
<link type="text/css" rel="stylesheet" href="/css/toggle.css" />

View File

@@ -8,9 +8,4 @@
<script src="/js/bootstrap.min.js"></script>
<script src="/js/bootstrap.bundle.min.js"></script>
@endpush
@push('css_head')
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>
@endpush

View File

@@ -1,10 +1,5 @@
@extends('layouts/eatvio')
@section('page_title', 'Chat')
@push('css_head')
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>
@endpush
@section('main_section')
<section class="py-md-3 px-0 px-md-2 px-lg-3 --h_90vh" id="main" x-data>

View File

@@ -1,9 +1,5 @@
@extends('layouts/eatvio')
@push('css_head')
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>
@endpush
@section('main_section')
<section class="py-5" id="main">
<div class="container d-flex justify-content-between align-items-center mb-4 px-4 py-2 --bg_white --shadow --radius --mw-1000">

View File

@@ -8,7 +8,6 @@
@endisset
@endsection
@push('css_head')
{{-- <script src="/js/build/ckeditor.js" defer></script> --}}
<script src="/js/ckeditor.js"></script>
@endpush
@push('jq_scripts')

View File

@@ -9,11 +9,6 @@
$mealNames = ['breakfast', 'dinner', 'supper', 'lunch', 'snacks'];
@endphp
@push('css_head')
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>
@endpush
@section('main_section')
<section class="py-5" id="main">
@@ -76,7 +71,7 @@
</div>
<div class="d-flex my-3 align-items-center justify-content-between">
<div class="d-flex align-items-center">
<div class="d-flex align-items-center w-1/2 overflow-hidden">
<a href="{{ route('profile.show', $author) }}">
<img src="{{ $authorPhoto }}" width="42px" height="42px" class="me-2 --radius_100" style="height: 42px;">
<small>
@@ -106,7 +101,7 @@
<div class="h6 --f_bold --no_wrap_normal">{{ $diet->name }}</div>
<small class="d-block --no_wrap_normal">{!! Str::of(strip_tags($diet->details))->words(7, '...') !!}</small>
</div>
<div class="d-flex align-items-center">
<div class="d-flex align-items-center mb-2 ml-2">
<a href="{{ route("diet.show", $diet) }}" class="btn btn-secondary ms-1 py-1" >Просмотр</a>
</div>
</div>

View File

@@ -1,7 +1,7 @@
@extends('layouts/eatvio')
@php
$author = $diet->author()->first();
$authorPhoto = Storage::url($author->profile_photo_path);
$authorPhoto = $author->profile_photo_url;
$image = Storage::url($diet->image);
$typeToSvgId = [

View File

@@ -16,11 +16,8 @@ $isDiary = Str::of($curUrl)->test('/\/diary/');
<link type="text/css" rel="stylesheet" href="/css/liana_reset.css" />
<style>@import url('https://fonts.googleapis.com/css2?family=Mulish:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');</style>
<link type="text/css" rel="stylesheet" href="{{ mix('css/app.css') }}" />
<!--link type="text/css" rel="stylesheet" href="/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="/css/datepicker.min.css" /-->
<link type="text/css" rel="stylesheet" href="/css/style.css" />
<link type="text/css" rel="stylesheet" href="/css/liana_style.css" />
{{-- <script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script> --}}
{{-- @livewireStyles --}}

View File

@@ -26,7 +26,7 @@
</ul>
@endforeach
@endisset
<button type="button" class="settings__price-bid btn btn-green">Заказать за
<button type="button" class="settings__price-bid l-btn l-btn-green">Заказать за
{{ $options1['price'] ?? '0' }}₽</button>
</div>
</div>
@@ -59,7 +59,7 @@
</ul>
@endforeach
@endisset
<button type="button" class="settings__price-bid btn btn-green">Заказать за
<button type="button" class="settings__price-bid l-btn l-btn-green">Заказать за
{{ $options2['price'] ?? '0' }}
₽</button>
</div>
@@ -92,7 +92,7 @@
</ul>
@endforeach
@endisset
<button type="button" class="settings__price-bid btn btn-green">Заказать за
<button type="button" class="settings__price-bid l-btn l-btn-green">Заказать за
{{ $options3['price'] ?? '0' }}
₽</button>
</div>

View File

@@ -20,7 +20,7 @@
<label class="star-rating__label" for="rate-1"></label>
<input wire:model="isChecked" wire:click="$set('grade',0)" type="radio" name="rate" id="rate-0" value="1" hidden>
</div>
<button wire:click.prevent="save" type="button" class="btn btn-primary">Оставь отзыв</button>
<button wire:click.prevent="save" type="button" class="l-btn l-btn-primary">Оставь отзыв</button>
</div>

View File

@@ -190,11 +190,11 @@
</div>
<div class="diary__stats-tablist" role="tablist" aria-labelledby="label">
<button wire:click="$set('packets_count', 1)"
class="btn {{ $packets_count === 1 ? 'active' : '' }}" role="tab" type="button"
class="l-btn {{ $packets_count === 1 ? 'active' : '' }}" role="tab" type="button"
id="tab-1" aria-selected="{{ $packets_count === 1 ? 'true' : 'false' }}"
aria-controls="tabpanel-1">1 пакет</button>
<button wire:click="$set('packets_count', 3)"
class="btn {{ $packets_count === 3 ? 'active' : '' }}" role="tab" type="button"
class="l-btn {{ $packets_count === 3 ? 'active' : '' }}" role="tab" type="button"
id="tab-2" aria-selected="{{ $packets_count === 3 ? 'true' : 'false' }}"
aria-controls="tabpanel-2" tabindex="-1">3 пакета</button>
</div>
@@ -258,7 +258,7 @@
<button
wire:click="addPacketOption('packet1_options', 'packet1_options_input')"
type="button" class="btn btn-primary icon-plus"></button>
type="button" class="l-btn l-btn-primary icon-plus"></button>
</div>
</div>
@@ -325,7 +325,7 @@
<button
wire:click="addPacketOption('packet1_options', 'packet1_options_input')"
type="button" class="btn btn-primary icon-plus"></button>
type="button" class="l-btn l-btn-primary icon-plus"></button>
</div>
</div>
@@ -393,7 +393,7 @@
<button
wire:click="addPacketOption('packet2_options', 'packet2_options_input')"
type="button" class="btn btn-primary icon-plus"></button>
type="button" class="l-btn l-btn-primary icon-plus"></button>
</div>
</div>
@@ -462,7 +462,7 @@
<button
wire:click="addPacketOption('packet3_options', 'packet3_options_input')"
type="button" class="btn btn-primary icon-plus"></button>
type="button" class="l-btn l-btn-primary icon-plus"></button>
</div>
</div>
@@ -497,11 +497,11 @@
<div class="diet__btns">
<button wire:click="addToDrafts" type="button" class="diet__btn btn btn-gray">В
<button wire:click="addToDrafts" type="button" class="diet__btn l-btn l-btn-gray">В
черновик</button>
<button wire:click="showPreview"type="button" class="diet__btn btn btn-gray">Превью</button>
<button wire:click="showPreview"type="button" class="diet__btn l-btn l-btn-gray">Превью</button>
<button wire:click.prevent="publish" type="button"
class="diet__btn btn btn-primary">Опубликовать</button>
class="diet__btn l-btn l-btn-primary">Опубликовать</button>
</div>
</div>

View File

@@ -192,11 +192,11 @@
</div>
<div class="diary__stats-tablist" role="tablist" aria-labelledby="label">
<button wire:click="$set('packets_count', 1)"
class="btn {{ $packets_count === 1 ? 'active' : '' }}" role="tab" type="button"
class="l-btn {{ $packets_count === 1 ? 'active' : '' }}" role="tab" type="button"
id="tab-1" aria-selected="{{ $packets_count === 1 ? 'true' : 'false' }}"
aria-controls="tabpanel-1">1 пакет</button>
<button wire:click="$set('packets_count', 3)"
class="btn {{ $packets_count === 3 ? 'active' : '' }}" role="tab" type="button"
class="l-btn {{ $packets_count === 3 ? 'active' : '' }}" role="tab" type="button"
id="tab-2" aria-selected="{{ $packets_count === 3 ? 'true' : 'false' }}"
aria-controls="tabpanel-2" tabindex="-1">3 пакета</button>
</div>
@@ -258,7 +258,7 @@
<button wire:click="addPacketOption('packet1_options', 'packet1_options_input')"
type="button" class="btn btn-primary icon-plus"></button>
type="button" class="l-btn l-btn-primary icon-plus"></button>
</div>
</div>
@@ -323,7 +323,7 @@
<button wire:click="addPacketOption('packet1_options', 'packet1_options_input')"
type="button" class="btn btn-primary icon-plus"></button>
type="button" class="l-btn l-btn-primary icon-plus"></button>
</div>
</div>
@@ -389,7 +389,7 @@
<button wire:click="addPacketOption('packet2_options', 'packet2_options_input')"
type="button" class="btn btn-primary icon-plus"></button>
type="button" class="l-btn l-btn-primary icon-plus"></button>
</div>
</div>
@@ -456,7 +456,7 @@
<button wire:click="addPacketOption('packet3_options', 'packet3_options_input')"
type="button" class="btn btn-primary icon-plus"></button>
type="button" class="l-btn l-btn-primary icon-plus"></button>
</div>
</div>
@@ -480,11 +480,11 @@
<div class="diet__btns">
<button wire:click="addToDrafts" type="button" class="diet__btn btn btn-gray">В
<button wire:click="addToDrafts" type="button" class="diet__btn l-btn l-btn-gray">В
черновик</button>
<button wire:click="showPreview"type="button" class="diet__btn btn btn-gray">Превью</button>
<button wire:click="showPreview"type="button" class="diet__btn l-btn l-btn-gray">Превью</button>
<button wire:click.prevent="publish" type="button"
class="diet__btn btn btn-primary">Опубликовать</button>
class="diet__btn l-btn l-btn-primary">Опубликовать</button>
</div>
</div>

View File

@@ -2,11 +2,6 @@
@php
$typeToSvgId = ['slim' => '#SlimBig', 'fit' => '#FitBig', 'wellness' => '#WellnessBig', 'behavior' => '#BehaviorBig'];
@endphp
@push('css_head')
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>
@endpush
@section('main_section')
<section class="py-5" id="main">
<form class="container d-block d-sm-flex justify-content-between align-items-end align-items-lg-center mb-4 p-0 --mw-1170" action="" type="">

View File

@@ -1,10 +1,5 @@
@extends('layouts/eatvio')
@section('page_title', $user->name ." Profile")
@push('css_head')
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>
@endpush
@section('main_section')
<section class="py-5" id="main">
<div class="container d-flex justify-content-between align-items-center mb-5 px-4 py-4 --bg_white --shadow --radius --mw-1000">

View File

@@ -4,9 +4,4 @@
@endsection
@section('page_title', 'Recipes list')
@push('css_head')
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>
@endpush

View File

@@ -1,10 +1,5 @@
@extends('layouts/eatvio')
@section('page_title', $user->name ." Profile")
@push('css_head')
<script src="https://cdn.tailwindcss.com"></script>
<link type="text/css" rel="stylesheet" href="/css/bootstrap.min.css" />
@endpush
@section('main_section')
<section class="py-5" id="main">
<div class="container d-flex justify-content-between align-items-center mb-5 px-4 py-4 --bg_white --shadow --radius --mw-1000">

View File

@@ -11,6 +11,7 @@ export default {
'./resources/views/**/*.blade.php',
'./resources/views/**/**/*.blade.php',
'./vendor/masmerise/livewire-toaster/resources/views/*.blade.php',
'./resources/**/*.blade.php',
],
theme: {

View File

@@ -1,42 +0,0 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\Recipe;
use App\Models\Recipe;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
/**
* @internal
*/
final class EditFormTest extends TestCase
{
use RefreshDatabase;
protected User $user;
private Recipe $recipe;
public function setUp(): void
{
$this->refreshApplicationWithLocale('en');
$this->user = User::factory()->create(['is_consultant' => true]);
$this->recipe = Recipe::inRandomOrder()->first();
}
public function test_edit_page_recipe_success(): void
{
$response = $this
->actingAs($this->user)
->get(route('recipe.edit', $this->recipe, false));
$response->assertSuccessful();
}
}

View File

@@ -0,0 +1,192 @@
<?php declare(strict_types=1);
namespace Tests\Feature\Recipe;
use App\Livewire\Recipe\Edit;
use App\Models\Recipe;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Storage;
use Livewire\Livewire;
use Tests\TestCase;
/**
* @internal
*/
final class EditTest extends TestCase
{
use RefreshDatabase;
protected User $user;
private Recipe $recipe;
public function setUp(): void
{
$this->refreshApplicationWithLocale('en');
$this->user = User::factory()->create(['is_consultant' => true]);
$this->recipe = Recipe::inRandomOrder()->first();
}
public function test_edit_page_recipe_success(): void
{
$response = $this
->actingAs($this->user)
->get(route('recipe.edit', $this->recipe, false));
$response->assertSuccessful();
}
public function testUpdateRecipePublishSuccess(): void
{
$this->actingAs($this->user);
$recipe = $this->recipe = Recipe::factory()->make();
$recipeUpdate = Livewire::test(Edit::class, [
'recipe' => $this->recipe,
])
->set('title', $recipe->title)
->assertSet('title', $recipe->title)
->set('image', $recipe->image)
->set('state', $recipe->state)
->assertSet('state', $recipe->state)
->set('cooking_time', $recipe->cooking_time)
->assertSet('cooking_time', $recipe->cooking_time)
->set('ingredients', $recipe->ingredients)
->assertSet('ingredients', $recipe->ingredients)
->set('type', $recipe->type)
->assertSet('type', $recipe->type)
->set('description', $recipe->description)
->assertSet('description', $recipe->description)
->set('video_url', $recipe->video_url)
->assertSet('video_url', $recipe->video_url)
->call('publish')
->assertSuccessful()
->assertHasNoErrors(['title', 'image', 'state', 'cooking_time', 'ingredients', 'type', 'description', 'steps', 'video_url']);
Storage::disk('public')->assertExists($this->recipe->image);
// check data after update recipe
self::assertEquals($recipe->title, $recipeUpdate->title);
self::assertEquals($recipe->image, $recipeUpdate->image);
self::assertEquals($recipe->state, $recipeUpdate->state);
self::assertEquals($recipe->cooking_time, $recipeUpdate->cooking_time);
self::assertEquals($recipe->ingredients, $recipeUpdate->ingredients);
self::assertEquals($recipe->type, $recipeUpdate->type);
self::assertEquals($recipe->description, $recipeUpdate->description);
self::assertEquals($recipe->video_url, $recipeUpdate->video_url);
}
public function testUpdateRecipeDraftSuccess(): void
{
$this->actingAs($this->user);
$recipe = $this->recipe = Recipe::factory()->make();
$recipeUpdate = Livewire::test(Edit::class, [
'recipe' => $this->recipe,
])
->set('title', $recipe->title)
->assertSet('title', $recipe->title)
->set('image', $recipe->image)
->set('state', $recipe->state)
->assertSet('state', $recipe->state)
->set('cooking_time', $recipe->cooking_time)
->assertSet('cooking_time', $recipe->cooking_time)
->set('ingredients', $recipe->ingredients)
->assertSet('ingredients', $recipe->ingredients)
->set('type', $recipe->type)
->assertSet('type', $recipe->type)
->set('description', $recipe->description)
->assertSet('description', $recipe->description)
->set('video_url', $recipe->video_url)
->assertSet('video_url', $recipe->video_url)
->call('draft')
->assertSuccessful()
->assertHasNoErrors(['title', 'image', 'state', 'cooking_time', 'ingredients', 'type', 'description', 'steps', 'video_url']);
Storage::disk('public')->assertExists($this->recipe->image);
// check data after update recipe
self::assertEquals($recipe->title, $recipeUpdate->title);
self::assertEquals($recipe->image, $recipeUpdate->image);
self::assertEquals('archived', $recipeUpdate->state);
self::assertEquals($recipe->cooking_time, $recipeUpdate->cooking_time);
self::assertEquals($recipe->ingredients, $recipeUpdate->ingredients);
self::assertEquals($recipe->type, $recipeUpdate->type);
self::assertEquals($recipe->description, $recipeUpdate->description);
self::assertEquals($recipe->video_url, $recipeUpdate->video_url);
}
public function testUpdateRecipePreviewSuccess(): void
{
$this->actingAs($this->user);
$recipe = $this->recipe = Recipe::factory()->make();
$recipeUpdate = Livewire::test(Edit::class, [
'recipe' => $this->recipe,
])
->set('title', $recipe->title)
->assertSet('title', $recipe->title)
->set('image', $recipe->image)
->set('state', $recipe->state)
->assertSet('state', $recipe->state)
->set('cooking_time', $recipe->cooking_time)
->assertSet('cooking_time', $recipe->cooking_time)
->set('ingredients', $recipe->ingredients)
->assertSet('ingredients', $recipe->ingredients)
->set('type', $recipe->type)
->assertSet('type', $recipe->type)
->set('description', $recipe->description)
->assertSet('description', $recipe->description)
->set('video_url', $recipe->video_url)
->assertSet('video_url', $recipe->video_url)
->call('preview')
->assertSuccessful()
->assertHasNoErrors(['title', 'image', 'state', 'cooking_time', 'ingredients', 'type', 'description', 'steps', 'video_url']);
Storage::disk('public')->assertExists($this->recipe->image);
// check data after update recipe
self::assertEquals($recipe->title, $recipeUpdate->title);
self::assertEquals($recipe->image, $recipeUpdate->image);
self::assertEquals('archived', $recipeUpdate->state);
self::assertEquals($recipe->cooking_time, $recipeUpdate->cooking_time);
self::assertEquals($recipe->ingredients, $recipeUpdate->ingredients);
self::assertEquals($recipe->type, $recipeUpdate->type);
self::assertEquals($recipe->description, $recipeUpdate->description);
self::assertEquals($recipe->video_url, $recipeUpdate->video_url);
}
public function testNothingChange(): void
{
$this->actingAs($this->user);
$recipeUpdate = Livewire::test(Edit::class, [
'recipe' => $this->recipe,
])
->call('publish')
->assertSuccessful()
->assertHasNoErrors(['title', 'image', 'state', 'cooking_time', 'ingredients', 'type', 'description', 'steps', 'video_url']);
Storage::disk('public')->assertExists($this->recipe->image);
// check data after update recipe
self::assertEquals($this->recipe->title, $recipeUpdate->title);
self::assertEquals($this->recipe->image, $recipeUpdate->image);
self::assertEquals($this->recipe->state, $recipeUpdate->state);
self::assertEquals($this->recipe->cooking_time, $recipeUpdate->cooking_time);
self::assertEquals($this->recipe->ingredients, $recipeUpdate->ingredients);
self::assertEquals($this->recipe->type, $recipeUpdate->type);
self::assertEquals($this->recipe->description, $recipeUpdate->description);
self::assertEquals($this->recipe->video_url, $recipeUpdate->video_url);
}
}

View File

@@ -16,7 +16,8 @@ mix.js('resources/js/app.js', 'public/js')
.postCss('resources/css/app.css', 'public/css', [
require('postcss-import'),
require('tailwindcss'),
]);
])
.sass('resources/sass/app.scss', 'public/css');
if (mix.inProduction()) {
mix.version();