From 1f05fcf352626a80a4ef3dc0ce6999053e9aa42d Mon Sep 17 00:00:00 2001
From: Shivam Mathur
Date: Thu, 26 Sep 2019 19:49:20 +0530
Subject: [PATCH] Switch to PCOV
---
.github/workflows/actions.yml | 10 ++++++----
.gitignore | 1 -
.htaccess | 5 +++--
.travis.yml | 11 ++++++++++-
README.md | 14 ++++++++++++--
index.php | 2 +-
public/.htaccess | 5 +++--
templates/countries.php | 1 +
templates/home.php | 14 ++++++++++++++
9 files changed, 50 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml
index 6707d99..4b240a1 100644
--- a/.github/workflows/actions.yml
+++ b/.github/workflows/actions.yml
@@ -14,16 +14,18 @@ jobs:
- name: Set up php and composer
uses: shivammathur/setup-php@develop
with:
- php-version: ${{ matrix.php-versions }}
- extension-csv: 'mbstring, xdebug'
+ php-version: ${{ matrix.php-versions }}
+ extension-csv: 'mbstring'
+ ini-values-csv: 'pcov.directory=api'
+ coverage: 'pcov'
- name: Install dependencies
run: composer self-update && composer install
- name: Test with phpunit in windows
if: matrix.operating-system == 'windows-latest'
- run: .\vendor\bin\phpunit --dump-xdebug-filter xdebug-filter.php && .\vendor\bin\phpunit --prepend xdebug-filter.php --coverage-clover build/logs/clover.xml --coverage-text
+ run: .\vendor\bin\phpunit --coverage-clover build/logs/clover.xml --coverage-text
- name: Test with phpunit
if: matrix.operating-system != 'windows-latest'
- run: vendor/bin/phpunit --dump-xdebug-filter xdebug-filter.php && vendor/bin/phpunit --prepend xdebug-filter.php --coverage-clover build/logs/clover.xml --coverage-text
+ run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml --coverage-text
- name: coveralls
run: sh -c php vendor/bin/php-coveralls -v
- name: codecov-umbrella
diff --git a/.gitignore b/.gitignore
index 86bb4c1..9501907 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
vendor/*
-logs/*
build/*
xdebug-filter.php
.phpunit.result.cache
diff --git a/.htaccess b/.htaccess
index 51c6bee..48a7a3d 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,3 +1,4 @@
-RewriteEngine On
+RewriteEngine on
+RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
-RewriteRule ^ index.php [QSA,L]
+RewriteRule . index.php [L]
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index ab0e3d0..6fc6140 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,9 +6,18 @@ php:
before_install:
- sudo pip install cpp-coveralls
before_script:
+ - sudo add-apt-repository ppa:ondrej/php -y
+ - sudo apt update -y
+ - pecl install pcov
+ - phpenv config-rm xdebug.ini
+ - ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
+ - echo $ini_file
+ - echo "pcov.enabled=1" >> $ini_file
+ - echo "pcov.directory=api" >> $ini_file
+ - php -v && php -m
- composer self-update
- composer install
-script: vendor/bin/phpunit --dump-xdebug-filter xdebug-filter.php && vendor/bin/phpunit --prepend xdebug-filter.php --coverage-clover build/logs/clover.xml --coverage-text
+script: vendor/bin/phpunit --coverage-clover build/logs/clover.xml --coverage-text
after_success:
- cat build/logs/clover.xml
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php vendor/bin/php-coveralls -v; fi;'
diff --git a/README.md b/README.md
index e524ac5..1c37c36 100644
--- a/README.md
+++ b/README.md
@@ -35,15 +35,25 @@ composer create-project shivammathur/countrycity countrycity "master-dev" --pref
All API responses are in `json` format.
- Get the list of all countries
-```
+```bash
/countries
+
+# Without URL Rewriting
+/index.php/countries
```
- Get the list all cities in a country
-```
+```bash
/cities/{countryName}
+
+# Without URL Rewriting
+/index.php/cities/{countryName}
```
+### Host this
+Here are the [Configuration Instructions](http://www.slimframework.com/docs/v3/start/web-servers.html) for if you want to host this.
+
+
### :wrench: Error Format
If there is an error in the API, you will get an error in `json` format as response
diff --git a/index.php b/index.php
index 8d0cfc0..eb3fd73 100644
--- a/index.php
+++ b/index.php
@@ -1,2 +1,2 @@
getAllCountries();
diff --git a/templates/home.php b/templates/home.php
index a93e7d9..9abf928 100644
--- a/templates/home.php
+++ b/templates/home.php
@@ -23,6 +23,11 @@
/countries
+
+ Without URL Rewriting
+
+ /index.php/countries
+
Get All Cities in a Country
@@ -30,6 +35,15 @@
/cities/{countryName}
+
+ Without URL Rewriting
+
+ /index.php/cities/{countryName}
+
+
+
+
+ Here are the server configuration instructions if you want to host this on a server.
Error Format