From 98bfd2ed5fe3f5658135c0b3f429261c172fec9a Mon Sep 17 00:00:00 2001 From: A1Gard Date: Thu, 29 Jun 2023 14:26:02 +0330 Subject: [PATCH 1/3] fix create problem --- .../views/admin/invoice/invoiceForm.blade.php | 78 ++++++++++--------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/resources/views/admin/invoice/invoiceForm.blade.php b/resources/views/admin/invoice/invoiceForm.blade.php index eec202b..61c5f4e 100755 --- a/resources/views/admin/invoice/invoiceForm.blade.php +++ b/resources/views/admin/invoice/invoiceForm.blade.php @@ -29,9 +29,9 @@ @@ -76,43 +76,49 @@ value="{{old('tracking_code',$invoice->tracking_code??null)}}"/> - @foreach($invoice->products as $product ) + @if(isset($invoice)) + @foreach($invoice->products as $product ) -
-
-
-
-
- - -
-
-
-
- - - -
-
+
+
+
+
+
+ + +
+
+
+
+ + + +
+
-
-
-
+
+
+
+ + @endforeach + @endif - @endforeach
From 4f5b7af19743719b16aa7b7aaecdecb3b3df1356 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Thu, 29 Jun 2023 20:32:31 +0330 Subject: [PATCH 2/3] create admin web page test --- tests/Feature/AdminWebPagesTest.php | 397 ++++++++++++++++++++++++++++ tests/Feature/ExampleTest.php | 21 -- tests/Unit/ExampleTest.php | 18 -- 3 files changed, 397 insertions(+), 39 deletions(-) create mode 100644 tests/Feature/AdminWebPagesTest.php delete mode 100755 tests/Feature/ExampleTest.php delete mode 100755 tests/Unit/ExampleTest.php diff --git a/tests/Feature/AdminWebPagesTest.php b/tests/Feature/AdminWebPagesTest.php new file mode 100644 index 0000000..8b8111a --- /dev/null +++ b/tests/Feature/AdminWebPagesTest.php @@ -0,0 +1,397 @@ +getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.user.all')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.user.create')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.user.edit',$user->id)); + $response->assertStatus(200); + + + } + + public function test_category_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.category.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.category.create')); + $response->assertStatus(200); + + if (Category::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.category.edit',Category::first()->slug)); + $response->assertStatus(200); + } + + } + + public function test_post_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.post.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.post.create')); + $response->assertStatus(200); + + if (Post::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.post.edit',Post::first()->slug)); + $response->assertStatus(200); + } + + } + + public function test_gallery_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.gallery.all')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.gallery.create')); + $response->assertStatus(200); + + if (Gallery::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.gallery.edit',Gallery::first()->slug)); + $response->assertStatus(200); + } + + } + + public function test_adv_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.adv.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.adv.create')); + $response->assertStatus(200); + + if (Adv::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.adv.edit',Adv::first()->slug)); + $response->assertStatus(200); + } + + } + public function test_attachment_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.attachment.index')); + $response->assertStatus(200); + + } + + public function test_cat_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.cat.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.cat.create')); + $response->assertStatus(200); + + if (Cat::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.cat.edit',Cat::first()->slug)); + $response->assertStatus(200); + } + + } + public function test_clip_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.clip.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.clip.create')); + $response->assertStatus(200); + + if (Clip::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.clip.edit',Clip::first()->slug)); + $response->assertStatus(200); + } + + } + public function test_comment_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.comment.index')); + $response->assertStatus(200); + + if (Comment::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.comment.edit',Comment::first()->id)); + $response->assertStatus(200); + } + + } + public function test_contact_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.contact.index')); + $response->assertStatus(200); + + if (Contact::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.contact.reply',Contact::first()->id)); + $response->assertStatus(200); + $response = $this->actingAs($user)->get(route('admin.contact.show',Contact::first()->id)); + $response->assertStatus(200); + } + + } + + public function test_customer_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.customer.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.customer.create')); + $response->assertStatus(200); + + if (Customer::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.customer.edit',Customer::first()->slug)); + $response->assertStatus(200); + } + + } + public function test_discount_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.discount.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.discount.create')); + $response->assertStatus(200); + + if (Discount::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.discount.edit',Discount::first()->id)); + $response->assertStatus(200); + } + + } + + public function test_question_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.question.index')); + $response->assertStatus(200); + + if (Question::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.question.edit',Question::first()->id)); + $response->assertStatus(200); + } + + } + public function test_invoice_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.invoice.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.invoice.create')); + $response->assertStatus(200); + + if (Invoice::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.invoice.edit',Invoice::first()->id)); + $response->assertStatus(200); + } + + } + public function test_menu_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.menu.index')); + $response->assertStatus(200); + + + if (Menu::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.menu.manage',Menu::first()->id)); + $response->assertStatus(200); + } + + } + + public function test_slider_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.slider.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.slider.create')); + $response->assertStatus(200); + + if (Slider::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.slider.edit',Slider::first()->id)); + $response->assertStatus(200); + } + + } + + public function test_poll_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.poll.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.poll.create')); + $response->assertStatus(200); + + if (Poll::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.poll.edit',Poll::first()->id)); + $response->assertStatus(200); + } + + } + public function test_product_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.product.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.product.create')); + $response->assertStatus(200); + + if (Product::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.product.edit',Product::first()->slug)); + $response->assertStatus(200); + } + + } + + + public function test_ticket_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.ticket.index')); + $response->assertStatus(200); + +// $response = $this->actingAs($user)->get(route('admin.ticket.create')); +// $response->assertStatus(200); + + if (Ticket::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.ticket.edit',Ticket::first()->id)); + $response->assertStatus(200); + } + + } + public function test_transport_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.transport.index')); + $response->assertStatus(200); + + $response = $this->actingAs($user)->get(route('admin.transport.create')); + $response->assertStatus(200); + + if (Transport::count() != 0){ + $response = $this->actingAs($user)->get(route('admin.transport.edit',Transport::first()->id)); + $response->assertStatus(200); + } + + } + + public function test_setting_urls() + { + + $user = $this->getValidUser(); + + $response = $this->actingAs($user)->get(route('admin.setting.index')); + $response->assertStatus(200); + + } + + + private function getValidUser(){ + if (User::where('email','admin@example.com')->count() == 0){ + + if (Role::where('name','super-admin')->count() == 0){ + $role = Role::create(['name' => 'super-admin']); + }else{ + $role = Role::where('name','super-admin')->first(); + } + + $user = User::factory()->count(1)->create(['email' => 'admin@example.com']); + $user->assignRole($role); + }else{ + $user = User::where('email','admin@example.com')->first(); + } + return $user; + } +} diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php deleted file mode 100755 index 78ccc21..0000000 --- a/tests/Feature/ExampleTest.php +++ /dev/null @@ -1,21 +0,0 @@ -get('/'); - - $response->assertStatus(200); - } -} diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php deleted file mode 100755 index e5c5fef..0000000 --- a/tests/Unit/ExampleTest.php +++ /dev/null @@ -1,18 +0,0 @@ -assertTrue(true); - } -} From 59a1ebbaf31d435dea75e0306b41722e72f39f15 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Thu, 29 Jun 2023 20:36:51 +0330 Subject: [PATCH 3/3] updated readme --- README-fa.md | 12 +++++++++++- README.md | 14 +++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/README-fa.md b/README-fa.md index e6c6654..8b5643a 100755 --- a/README-fa.md +++ b/README-fa.md @@ -122,7 +122,7 @@ crontab -e ```bash * * * * * cd /home/[yourusername]/[your-public-html-project-root] && php artisan schedule:run >> /dev/null 2>&1 ``` -## contribute & support +## همکاری و پشتیبانی ما خیلی خوشحال می‌شویم از شما را کمک کنیم و یا شما ما رو کمک کنید، در صورت توسعه سورس حتما از pull request شما اتسقبال می‌کنیم و اگر مشکلی داشتید، حتما آن را برطرف می‌کنیم، فقط کافی است یک موضوع در لینک زیر ایجاد کنید: @@ -130,6 +130,16 @@ crontab -e https://github.com/4xmen/xshop/issues ``` + +## تست پروژه + +نکته: تست را حتماً برای نسخه توسعه استفاده کنید نه روی وبسایت زیر بار دستور تست از قرار ذیل است: + +```bash +php artisan test +``` + + ## Screen shots ![1](./media/shopscreenshot1.png) diff --git a/README.md b/README.md index 5c354ca..92e6114 100755 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ php artisan serv now login to admin panel `http://localhost:8000/dashboard` default admin email is : `admin@example.com` and default password is: `password` -# Deploy guide +## Deploy guide We recommend deploy xshop on VPS, so create databse and run this commands @@ -108,7 +108,7 @@ php key:generate composer install --optimize-autoloader --no-dev ``` -### add cron job +### Add cron job You must add crontab for your project: @@ -121,7 +121,7 @@ Add this line: * * * * * cd /home/[yourusername]/[your-public-html-project-root] && php artisan schedule:run >> /dev/null 2>&1 ``` -## contribute & support +## Contribute & support We are so pleased to your help and help you, If you wanna develop xshop, Congrats or if you have problem, don't worry create an issue here: @@ -130,6 +130,14 @@ if you have problem, don't worry create an issue here: https://github.com/4xmen/xshop/issues ``` +## Test + +Note: The test must be run on development version, and test command is: + +```bash +php artisan test +``` + ## Screen shots ![1](./media/shopscreenshot1.png)