/ecommerce

Laravel example app

Primary LanguagePHP

eCommerce CommentSold

Laravel example app

Development Setup


Local Requirements


  1. Make
  2. Composer
  3. Docker
  4. Docker Compose

Setup

Create containers and conf files for test and run the app.

make setup

Run

Run the app at http://localhost

make run

app_preview

Tests

make test
PHPUnit 9.5.20

Inventory Model (Tests\Feature\InventoryModel)
 ✔ Get user inventory

Inventory Controller (Tests\Feature\InventoryController)
 ✔ Get user inventory
 ✔ Get user inventory sku
 ✔ Get user inventory product id

Products Controller (Tests\Feature\ProductsController)
 ✔ Can get user products
 ✔ Can get user product
 ✔ Can updated user product
 ✔ Fails update with invalid input with data set #0
 ✔ Fails update with invalid input with data set #1

Time: 00:04.973, Memory: 36.50 MB

OK (9 tests, 93 assertions)

Bonus


Apple Silicon


Create docker-compose.override.yml file and add:

version: '3.1'
services:

  db:
    image: mysql/mysql-server

  webserver:
    image: arm64v8/nginx

To use MySQL and NGINX ARM64 based images. php:7.4-fpm image arch-version used for the main app should be automatically pulled using the local arch.