Skip to content

arosiek/cart-sample

Repository files navigation

Sample cart project

sample usage

<?php

    $simpleCart = new SimpleCartFacade();
    $simpleCart->add('G01');
    $simpleCart->add('R01');
    $simpleCart->add('R01');
    $simpleCart->add('R01');
    
    $total = $simpleCart->total();

assumptions:

  • json file is used as products database
  • price precision is 2 (like 10.99)
  • I'm skipping $ sign in prices anywhere (assuming it is only task description)
  • not integrating phpcs+fixer or phpmd since it was not requirement (like phpstan)
  • default phpstorm configuration was used for coding format
  • code coverage was not any kind of goal instead of meaningful tests and TDD

requirements

  • docker
  • docker-compose

instalation

  1. docker-compose up -d
  2. inside container composer install or simply docker exec -it php_sample_cart bash -c "composer install"

run tests:

  • unit
    • docker exec -it php_sample_cart bash -c "vendor/bin/phpunit --configuration phpunit.xml --testsuite 'Unit Tests'"
  • integration
    • docker exec -it php_sample_cart bash -c "vendor/bin/phpunit --configuration phpunit.xml --testsuite 'Integration Tests'"
  • unit + integration:
    • docker exec -it php_sample_cart bash -c "composer test"
  • static tests (phpstan)
    • docker exec -it php_sample_cart bash -c "composer analyse"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published