Skip to content
Merged
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
59 changes: 59 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Tests

on: [push, pull_request]

env:
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction"
CC_TEST_REPORTER_ID: CODECLIMATE_REPORTER_ID
jobs:
phpunit:
name: PHP ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
steps:
## checkout the repoistory §
- name: Checkout Repo
uses: actions/checkout@v2

- name: Build server image
run: docker build . -t localserver
working-directory: ./tests/server

- name: Run test server
run: docker run -d -p 1234:80 localserver

## Install php
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, imagick, gd
ini-values: date.timezone='UTC'
coverage: xdebug

## install composer
- name: Install dependencies
run: composer install $DEFAULT_COMPOSER_FLAGS

## run unit tests
- name: PHP Unit tests for PHP
run: vendor/bin/phpunit --verbose --configuration actions.phpunit.xml
if: matrix.php == '8.0' || matrix.php == '7.4' || matrix.php == '7.3' || matrix.php == '7.2' || matrix.php == '7.0' || matrix.php == '5.6'

## unit test with coverage
- name: PHP Unit tests for PHP 7.1
run: vendor/bin/phpunit --verbose --coverage-clover=clover.xml --configuration actions.phpunit.xml
if: matrix.php == '7.1'

## coverage
- name: Code coverage
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter after-build -t clover
if: matrix.php == '7.1'
continue-on-error: true # if is fork
24 changes: 24 additions & 0 deletions actions.phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="true"
verbose="false"
bootstrap="vendor/autoload.php"
>
<php>
<ini name="display_errors" value="on"/>
</php>

<testsuites>
<testsuite name="PHP MP4Box Tests Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

</phpunit>
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"ext-curl": "*"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "~2.1"
"yoast/phpunit-polyfills": "^0.2.0"
},
"autoload": {
"psr-0": {
Expand Down
9 changes: 6 additions & 3 deletions tests/CurlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

namespace Curl;

class CurlTest extends \PHPUnit_Framework_TestCase
use Yoast\PHPUnitPolyfills\TestCases\TestCase;

class CurlTest extends TestCase
{

const TEST_URL = 'http://server_test';
const TEST_URL = 'http://localhost:1234';

/**
*
* @var Curl
*/
protected $curl;

function setUp() {
function set_up() {
parent::set_up();
$this->curl = new Curl();
$this->curl->setOpt(CURLOPT_SSL_VERIFYPEER, FALSE);
$this->curl->setOpt(CURLOPT_SSL_VERIFYHOST, FALSE);
Expand Down