Skip to content

Commit

Permalink
Switch to PCOV
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Sep 28, 2019
1 parent f9f94a7 commit 1f05fcf
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 13 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
vendor/*
logs/*
build/*
xdebug-filter.php
.phpunit.result.cache
5 changes: 3 additions & 2 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -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]
11 changes: 10 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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;'
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php
require __DIR__.'\public\index.php';
require __DIR__.'/public/index.php';
5 changes: 3 additions & 2 deletions public/.htaccess
Original file line number Diff line number Diff line change
@@ -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]
1 change: 1 addition & 0 deletions templates/countries.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
/** @var Location $Location */
$Location = new Location('data/geo.json');

/** @var $data */
echo $Location->getAllCountries();
14 changes: 14 additions & 0 deletions templates/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,27 @@
<code>
/countries
</code>
Without URL Rewriting
<code>
/index.php/countries
</code>
</p>
<h2>Get All Cities in a Country</h2>
<p>
<code>
/cities/{countryName}
</code>
Without URL Rewriting
<code>
/index.php/cities/{countryName}
</code>
</p>
<p>
Here are the <a target="_blank" href="http://www.slimframework.com/docs/v3/start/web-servers.html">server configuration instructions</a> if you want to host this on a server.
</p>
<h2>Error Format</h2>
Expand Down

0 comments on commit 1f05fcf

Please sign in to comment.