Skip to content

Commit

Permalink
Merge pull request #10 from maglnet/feature/github-actions
Browse files Browse the repository at this point in the history
switch to github actions
  • Loading branch information
maglnet authored Aug 11, 2021
2 parents a02c723 + 84b33a4 commit 18ba82f
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 45 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: unit-tests

on: [push]

jobs:
phpunit:
name: "PHPUnit tests"

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
php-version:
- "7.3"
- "7.4"
- "8.0"
operating-system:
- "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1

- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
- name: "Install dependencies"
if: ${{ matrix.php-version != '8.0' }}
run: "composer update --no-interaction --no-progress --no-suggest"
- name: "Install dependencies --ignore-platform-reqs"
if: ${{ matrix.php-version == '8.0' }}
run: "composer update --ignore-platform-reqs --no-interaction --no-progress --no-suggest"

- name: "Tests"
run: "vendor/bin/phpunit -c tests"

8 changes: 0 additions & 8 deletions .scrutinizer.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
],
"require": {
"php": "^7.0",
"php": "^7.3 || ^8.0",
"laminas/laminas-eventmanager": "^3.0",
"laminas/laminas-http": "^2.0",
"laminas/laminas-mvc": "^3.0",
Expand All @@ -33,7 +33,7 @@
"require-dev": {
"laminas/laminas-modulemanager": "^2.5",
"laminas/laminas-test": "^3.0",
"phpunit/phpunit": "^5.7"
"phpunit/phpunit": "^9"
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
namespace MaglLegacyApplicationTest\Application;

use MaglLegacyApplication\Application\MaglLegacy;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class MaglLegacyTest extends PHPUnit_Framework_TestCase
class MaglLegacyTest extends TestCase
{

public function testGetInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class LegacyControllerTest extends AbstractHttpControllerTestCase

protected $traceError = true;

public function setUp()
public function setUp(): void
{
$sm = \MaglLegacyApplicationTest\Bootstrap::getServiceManager();
$this->setApplicationConfig($sm->get('ApplicationConfig'));
Expand Down
6 changes: 3 additions & 3 deletions tests/MaglLegacyApplicationTest/ModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace MaglLegacyApplicationTest;

use MaglLegacyApplication\Module;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

/**
* Description of ModuleTest
*
* @author matthias
*/
class ModuleTest extends PHPUnit_Framework_TestCase
class ModuleTest extends TestCase
{

/**
Expand All @@ -19,7 +19,7 @@ class ModuleTest extends PHPUnit_Framework_TestCase
*/
private $instance;

public function setUp()
public function setUp(): void
{
$this->instance = new Module();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace MaglLegacyApplicationTest\Options;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class LegacyControllerOptionsTest extends PHPUnit_Framework_TestCase
class LegacyControllerOptionsTest extends TestCase
{

public function testSetGetDocRoot()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@

namespace MaglLegacyApplicationTest\Service;

use Laminas\Http\Response;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Mvc\Controller\ControllerManager;
use Laminas\View\Model\ViewModel;
use MaglLegacyApplication\Service\ControllerService;
use MaglLegacyApplicationTest\Bootstrap;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class ControllerServiceTest extends PHPUnit_Framework_TestCase
class ControllerServiceTest extends TestCase
{

/**
* @var ControllerService
*/
private $instance;

public function setUp()
public function setUp(): void
{
$this->instance = Bootstrap::getServiceManager()->get('MaglControllerService');
}
Expand All @@ -38,7 +39,8 @@ public function testRunControllerAction()
/** @var ControllerManager $controllerManager */
$controllerManager = Bootstrap::getServiceManager()->get('ControllerManager');
$controllerManager->setService('TestController', new TestController());
$this->instance->runControllerAction('TestController', 'test');
$response = $this->instance->runControllerAction('TestController', 'test');
$this->assertInstanceOf(Response::class, $response);
}

}
Expand Down

0 comments on commit 18ba82f

Please sign in to comment.