Skip to content

Commit 5b12559

Browse files
committed
tests: add test cases
1 parent 2543e95 commit 5b12559

11 files changed

Lines changed: 2027 additions & 38 deletions

File tree

.github/workflows/test.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Lint
2+
on: [push]
3+
jobs:
4+
lint:
5+
name: PHP Lint
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Setup PHP
9+
uses: shivammathur/setup-php@v2
10+
with:
11+
php-version: 8.2
12+
13+
- name: Cache Composer dependencies
14+
uses: actions/cache@v2
15+
with:
16+
path: /tmp/composer-cache
17+
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
18+
19+
- uses: actions/checkout@master
20+
- name: test
21+
run: make test

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
/vendor/
2+
.idea
3+
.phpunit.result.cache
4+
.phpunit.cache
5+
.vscode
6+
index.php

Makefile

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,40 @@
1+
.DEFAULT_GOAL := help
2+
3+
# -----------------------------------
4+
# Variables
5+
# -----------------------------------
6+
is_docker := $(shell docker info > /dev/null 2>&1 && echo 1)
7+
user := $(shell id -u)
8+
group := $(shell id -g)
9+
10+
ifeq ($(is_docker), 1)
11+
php := USER_ID=$(user) GROUP_ID=$(group) docker-compose run --rm --no-deps php
12+
composer := $(php) composer
13+
else
14+
php := php
15+
composer := composer
16+
endif
17+
18+
# -----------------------------------
19+
# Recipes
20+
# -----------------------------------
121
.PHONY: help
222
help: ## affiche cet aide
323
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
424

525
.PHONY: lint
626
lint: vendor/autoload.php ## affiche les erreurs de formatage de code
7-
php vendor/bin/ecs
8-
php vendor/bin/phpstan
27+
$(php) vendor/bin/ecs
28+
$(php) vendor/bin/phpstan
29+
30+
.PHONY: test
31+
test: vendor/autoload.php ## lance les tests
32+
$(php) vendor/bin/phpunit
933

1034
.PHONY: lint-fix
1135
lint-fix: vendor/autoload.php ## corrige les erreurs de formatage de code
12-
php vendor/bin/ecs --fix
36+
$(php) vendor/bin/ecs --fix
1337

1438
vendor/autoload.php: composer.lock # installe les dépendances PHP
15-
composer update
16-
composer dump-autoload
39+
$(composer) update
40+
$(composer) dump-autoload

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Maxicash PHP
22

33
![Lint](https://github.com/devscast/maxicash/actions/workflows/lint.yaml/badge.svg)
4+
![Test](https://github.com/devscast/maxicash/actions/workflows/test.yaml/badge.svg)
45
[![Latest Stable Version](https://poser.pugx.org/devscast/maxicash/version)](https://packagist.org/packages/devscast/maxicash)
56
[![Total Downloads](https://poser.pugx.org/devscast/maxicash/downloads)](https://packagist.org/packages/devscast/maxicash)
67
[![License](https://poser.pugx.org/devscast/maxicash/license)](https://packagist.org/packages/devscast/maxicash)
@@ -20,7 +21,7 @@ The MaxiCash Gateway enables the Merchant to Collect Payment into their MaxiCash
2021
### Authentication
2122
* **Step 1**. Download the MaxiCash Mobile App and signup...
2223
* **Step 2**. Contact us to upgrade your account to a Merchant Account info@maxicashapp.com
23-
You will receive a Merchant Form to complete in order to provide your business details and preffered Cashout Wallet or Banking Details.
24+
You will receive a Merchant Form to complete in order to provide your business details and preferred Cash out Wallet or Banking Details.
2425
* **Step 3**. Once the paperwork is completed, you will be issued with Live and Sandbox Accounts (MerchantID and MerchantPassword)
2526

2627

@@ -58,7 +59,7 @@ $url = $maxicash->queryStringURLPayment($entry);
5859
> **Note** : we highly recommand to do a `server side` redirection, this url can be modified and leak your maxicash credentials when displayed to your user in any manner (eg: a link, button or form) ! you can use the `header("Location: $url")` fonction in vanilla PHP or return a `RedirectResponse($url)` in your controller when using Symfony or Laravel frameworks`
5960
6061
### Donate Button for NGOs
61-
Once you signup as an NGO Merchant
62+
Once you sign up as an NGO Merchant
6263

6364
```php
6465
$donationUrl = $maxicash->donationUrl()

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
"Devscast\\Maxicash\\": "src/"
1515
}
1616
},
17+
"autoload-dev": {
18+
"psr-4": {
19+
"Devscast\\Maxicash\\Tests\\": "tests/"
20+
}
21+
},
1722
"authors": [
1823
{
1924
"name": "bernard-ng",
@@ -23,7 +28,8 @@
2328
"minimum-stability": "stable",
2429
"require-dev": {
2530
"phpstan/phpstan": "^1.10",
26-
"symplify/easy-coding-standard": "^12.0"
31+
"symplify/easy-coding-standard": "^12.0",
32+
"phpunit/phpunit": "^10.4"
2733
},
2834
"require": {
2935
"php": ">=8.2",

0 commit comments

Comments
 (0)