Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
HillLiu committed Mar 17, 2022
1 parent c69f9aa commit 065262b
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 27 deletions.
50 changes: 50 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: 2.1

jobs:
unittest:
parameters:
php-version:
type: string
plugin-name:
type: string
default: "nodejs"
docker:
- image: hillliu/pmvc-phpunit:<< parameters.php-version >>
working_directory: /var/www/<< parameters.plugin-name >>
steps:
- checkout
- run:
name: "Display information"
command: |
date
php -v
php -m
php -r "if(function_exists('gd_info'))print_r(gd_info());"
composer --version
phpunit --version
- run:
name: Composer install packages
command: |
composer install
- run:
name: PHPUnit
command: |
ENABLE_COVERAGE=false
if [ "<< parameters.php-version >>" == "8.1" ] && [ "$ENABLE_COVERAGE" == "true" ]; then
XDEBUG_MODE=coverage phpunit --coverage-clover clover.xml
coveralls --coverage_clover=clover.xml -v -o coveralls-upload.json
else
phpunit
fi
- store_artifacts:
path: /var/www/<< parameters.plugin-name >>/clover.xml
- store_artifacts:
path: /var/www/<< parameters.plugin-name >>/coveralls-upload.json

workflows:
run-job:
jobs:
- unittest:
matrix:
parameters:
php-version: ["8.1", "8.0", "5.6"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Latest Stable Version](https://poser.pugx.org/pmvc-plugin/nodejs/v/stable)](https://packagist.org/packages/pmvc-plugin/nodejs)
[![Latest Unstable Version](https://poser.pugx.org/pmvc-plugin/nodejs/v/unstable)](https://packagist.org/packages/pmvc-plugin/nodejs)
[![Build Status](https://travis-ci.org/pmvc-plugin/nodejs.svg?branch=master)](https://travis-ci.org/pmvc-plugin/nodejs)
[![CircleCI](https://circleci.com/gh/pmvc-plugin/nodejs/tree/main.svg?style=svg)](https://circleci.com/gh/pmvc-plugin/nodejs/tree/main)
[![License](https://poser.pugx.org/pmvc-plugin/nodejs/license)](https://packagist.org/packages/pmvc-plugin/nodejs)
[![Total Downloads](https://poser.pugx.org/pmvc-plugin/nodejs/downloads)](https://packagist.org/packages/pmvc-plugin/nodejs)

Expand All @@ -18,7 +18,7 @@ nodejs
```
{
"require": {
"pmvc-plugin/nodejs": "dev-master"
"pmvc-plugin/nodejs": "dev-main"
}
}
```
Expand Down
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
"require": {
"mouf/nodejs-installer": "v1.0.14"
},
"require-dev": {
"pmvc-plugin/unit": "*"
},
"config": {
"allow-plugins": {
"mouf/nodejs-installer": true
},
"extra": {
"mouf": {
"nodejs": {
Expand Down
29 changes: 6 additions & 23 deletions tests/include.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,9 @@
$path = __DIR__ . '/../vendor/autoload.php';
include $path;

\PMVC\Load::plug();
\PMVC\addPlugInFolders([__DIR__ . '/../../']);

if (!class_exists('PHPUnit_Framework_TestCase')) {
class PHPUnit_Framework_TestCase extends \PHPUnit\Framework\TestCase
{
}
class PHPUnit_Framework_Error extends Exception
{
}
}

class PMVC_TestCase extends PHPUnit_Framework_TestCase
{
public function haveString($needle, $haystack)
{
if (is_callable([$this, 'assertStringContainsString'])) {
$this->assertStringContainsString($needle, $haystack);
} else {
$this->assertContains($needle, $haystack);
}
}
}
\PMVC\Load::plug(
[
'unit' => null,
],
[__DIR__ . '/../../']
);
4 changes: 2 additions & 2 deletions tests/test.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace PMVC\PlugIn\nodejs;

use PMVC_TestCase;
use PMVC\TestCase;

class NodejsTest extends PMVC_TestCase
class NodejsTest extends TestCase
{
private $_plug = 'nodejs';
function testPlugin()
Expand Down

0 comments on commit 065262b

Please sign in to comment.