Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Use namespaces for classes and be complian to PSR-1, PSR-4 and PSR-12. #9

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions expensereport-php/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor/
.phpunit.cache/
42 changes: 0 additions & 42 deletions expensereport-php/ExpenseReport.php

This file was deleted.

7 changes: 5 additions & 2 deletions expensereport-php/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.PHONY: all
.PHONY: all tests
all:
php ExpenseReport.php
composer install

tests:
php vendor/bin/phpunit -c phpunit.xml
14 changes: 14 additions & 0 deletions expensereport-php/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Modern version of ExpenseReport with namespaces and PHPUnit

This PHP implementation of the ExpenseReport is more compliant to current PHP
standards (see https://www.php-fig.org/).

The folder now contains a "composer.json" file for dependency management and
the makefile contains targets to build the app (`make all` or simply `make`)
and run the unit-tests (`make tests`).

The configuration file for [PHPUnit](https://phpunit.de/) is sufficient to
start with simple tests and provides a first simple example on how to test the
output which is generated by the initial version of the ExpenseReport.

Happy Coding!
21 changes: 21 additions & 0 deletions expensereport-php/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "refactor/expensereport-php",
"type": "project",
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"Refactor\\ExpenseReportPhp\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Refactor\\ExpenseReportPhp\\": "tests/"
}
},
"minimum-stability": "stable"
}
Loading