Skip to content

Commit

Permalink
feat(#51): finalize migration + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Grummfy committed Feb 5, 2021
1 parent 3dd367e commit 5668fc6
Show file tree
Hide file tree
Showing 18 changed files with 126 additions and 98 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Linux

on:
push:
branches:
- master
- 4.x
pull_request:

jobs:
ubuntu-latest:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: [ '7.2', '7.3' ]
coverage: [ none ]
include:
- php-versions: '7.4'
coverage: xdebug
# see https://github.com/marketplace/actions/setup-php-action#nightly-build-setup
- php-versions: '8.0'
experimental: true
- php-versions: '8.1'
experimental: true
fail-fast: false

name: PHP ${{ matrix.php-versions }} on ubuntu-latest

steps:
- name: PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: ${{ matrix.coverage }}

- name: Checkout
uses: actions/checkout@v2

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

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php-versions }}-composer-

- name: Install dependencies
run: composer install --prefer-dist

- name: Run
run: vendor/bin/atoum --enable-branch-and-path-coverage --test-ext
1 change: 0 additions & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ return
'native_function_casing' => true,
'no_blank_lines_after_class_opening' => true,
'no_unused_imports' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'phpdoc_no_access' => true,
Expand Down
17 changes: 10 additions & 7 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
risky: true

preset: psr2

enabled:
- blankline_after_open_tag
- alpha_ordered_imports
- blank_line_after_opening_tag
- cast_spaces
- concat_with_spaces
- join_function
- native_function_casing
- no_alias_functions
- no_blank_lines_after_class_opening
- ordered_use
- no_leading_import_slash
- no_unused_imports
- no_whitespace_in_blank_line
- phpdoc_no_access
- remove_leading_slash_use
- self_accessor
- short_array_syntax
- spaces_cast
- unused_use
- whitespacy_lines

finder:
exclude:
Expand All @@ -24,4 +26,5 @@ finder:
path:
- "."
not-path:
- "resources/templates"
- "resources/html"
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 4.0.0 - 2020-02-05

* [#53](https://github.com/atoum/reports-extension/pull/53) Compatibility with atoum 4 & PHP 8 ([@franck-paul] & [@Grummfy])

# 3.0.0 - 2017-10-02

* [#46](https://github.com/atoum/reports-extension/pull/46) Remove the telemetry report ([@jubianchi])
Expand Down Expand Up @@ -65,3 +69,5 @@
[@jubianchi]: https://github.com/jubianchi
[@ppaulis]: https://github.com/ppaulis
[@vonglasow]: https://github.com/vonglasow
[@Grummfy]: https://github.com/Grummfy
[@franck-paul]: https://github.com/franck-paul
10 changes: 5 additions & 5 deletions classes/coverage/html.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace mageekguy\atoum\reports\coverage;
namespace atoum\atoum\reports\coverage;

use mageekguy\atoum;
use mageekguy\atoum\reports\coverage;
use mageekguy\atoum\reports\model;
use mageekguy\atoum\reports\score;
use atoum\atoum;
use atoum\atoum\reports\coverage;
use atoum\atoum\reports\model;
use atoum\atoum\reports\score;

class html extends coverage
{
Expand Down
8 changes: 4 additions & 4 deletions classes/model/coverage/klass.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace mageekguy\atoum\reports\model\coverage;
namespace atoum\atoum\reports\model\coverage;

use mageekguy\atoum\reports\model;
use mageekguy\atoum\reports\model\coverage;
use mageekguy\atoum\reports\template;
use atoum\atoum\reports\model;
use atoum\atoum\reports\model\coverage;
use atoum\atoum\reports\template;

class klass extends model
{
Expand Down
6 changes: 3 additions & 3 deletions classes/model/coverage/method.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace mageekguy\atoum\reports\model\coverage;
namespace atoum\atoum\reports\model\coverage;

use mageekguy\atoum\reports\model;
use mageekguy\atoum\reports\template;
use atoum\atoum\reports\model;
use atoum\atoum\reports\template;

class method extends model
{
Expand Down
5 changes: 4 additions & 1 deletion classes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace atoum\atoum\reports;

use Twig\Loader\FilesystemLoader;
use Twig\Environment;

class template
{
private $source;
Expand All @@ -11,7 +14,7 @@ public function __construct($source)
{
$this->source = $source;

$this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem([__DIR__ . '/../resources/html/templates']));
$this->twig = new Environment(new FilesystemLoader([__DIR__ . '/../resources/html/templates']));
}

public function render(array $model, $destination)
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
],
"minimum-stability": "beta",
"require": {
"php": "^5.4.0 || ^7.0.0 || ^8.0.0",
"twig/twig": "^1.18 | ^2.0",
"symfony/filesystem": "^2.6 | ^3.0 | ^4.0",
"atoum/atoum": "^2.9 || ^3.0 || ^4.0"
"php": "^7.2 || ^8.0.0",
"twig/twig": "^3.0",
"symfony/filesystem": "^5.0",
"atoum/atoum": "^4.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2"
Expand Down
4 changes: 2 additions & 2 deletions resources/html/templates/class.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
<th id="L{{ number }}" class="number {{ line.hit >= 1 ? 'covered' : line.hit == -1 ? 'uncovered' : line.hit == -2 ? 'unreach' : '' }}">{{ number }}</th>

<td class="{{ line.hit >= 1 ? 'covered' : line.hit == -1 ? 'uncovered' : line.hit == -2 ? 'unreach' : '' }}" {% if line.method %}id="{{ line.method }}"{% endif %}>
<pre>{{ line.code }}{% spaceless %}
<pre>{{ line.code }}{% apply spaceless %}
{% if line.method is not null %}
{{ macros.labelify(methods[line.method].coverage.lines) }}
{{ macros.navigation(class, line.method, methods[line.method].coverage, 'line') }}
{% endif %}
{% endspaceless %}</pre>
{% endapply %}</pre>
</td>
</tr>
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions resources/html/templates/macros.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% macro color(value) %}{% spaceless %}
{% macro color(value) %}{% apply spaceless %}
{{ value is not null ? (value < 0.3 ? 'danger' : (value < 0.7 ? 'warning' : 'success')) : 'default' }}
{% endspaceless %}{% endmacro %}
{% endapply %}{% endmacro %}

{% macro labelify(value) %}
{% set class = value is not null ? (value < 0.3 ? 'danger' : (value < 0.7 ? 'warning' : 'success')) : 'default' %}
Expand Down
6 changes: 3 additions & 3 deletions tests/units/classes/coverage/html.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace mageekguy\atoum\reports\tests\units\coverage;
namespace atoum\atoum\reports\tests\units\coverage;

use mageekguy\atoum;
use atoum\atoum;

class html extends atoum\test
{
public function testClass()
{
$this->testedClass->extends('mageekguy\atoum\reports\coverage');
$this->testedClass->extends('atoum\atoum\reports\coverage');
}
}
16 changes: 8 additions & 8 deletions tests/units/classes/extension.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<?php

namespace mageekguy\atoum\reports\tests\units;
namespace atoum\atoum\reports\tests\units;

use mageekguy\atoum;
use mageekguy\atoum\reports\extension as testedClass;
use atoum\atoum;
use atoum\atoum\reports\extension as testedClass;

class extension extends atoum\test
{
public function testClass()
{
$this
->testedClass
->implements('mageekguy\atoum\extension')
->implements('atoum\atoum\extension')
;
}

public function test__construct()
{
$this
->if($script = new atoum\scripts\runner(uniqid()))
->and($script->setArgumentsParser($parser = new \mock\mageekguy\atoum\script\arguments\parser()))
->and($configurator = new \mock\mageekguy\atoum\configurator($script))
->and($script->setArgumentsParser($parser = new \mock\atoum\atoum\script\arguments\parser()))
->and($configurator = new \mock\atoum\atoum\configurator($script))
->then
->object($extension = new testedClass())
->if($this->resetMock($parser))
Expand All @@ -35,7 +35,7 @@ public function testGetSetRunner()
{
$this
->if($this->newTestedInstance)
->and($runner = new \mock\mageekguy\atoum\runner())
->and($runner = new \mock\atoum\atoum\runner())
->then
->object($this->testedInstance->setRunner($runner))->isTestedInstance
->object($this->testedInstance->getRunner())->isIdenticalTo($runner)
Expand All @@ -46,7 +46,7 @@ public function testGetSetTest()
{
$this
->if($this->newTestedInstance)
->and($test = new \mock\mageekguy\atoum\test())
->and($test = new \mock\atoum\atoum\test())
->then
->object($this->testedInstance->setTest($test))->isTestedInstance
->object($this->testedInstance->getTest())->isIdenticalTo($test)
Expand Down
10 changes: 5 additions & 5 deletions tests/units/classes/model/coverage.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?php

namespace mageekguy\atoum\reports\tests\units\model;
namespace atoum\atoum\reports\tests\units\model;

use mageekguy\atoum;
use atoum\atoum;

class coverage extends atoum\test
{
public function testClass()
{
$this->testedClass->extends('mageekguy\atoum\reports\model');
$this->testedClass->extends('atoum\atoum\reports\model');
}

public function testCoverageIs()
{
$this
->given(
$this->mockGenerator->shuntParentClassCalls(),
$template = new \mock\mageekguy\atoum\reports\template(uniqid()),
$template = new \mock\atoum\atoum\reports\template(uniqid()),
$totalLines = rand(1, PHP_INT_MAX),
$coveredLines = rand(1, PHP_INT_MAX),
$totalBranches = rand(1, PHP_INT_MAX),
Expand Down Expand Up @@ -59,7 +59,7 @@ public function testAddClass()
->given(
$name = uniqid(),
$this->mockGenerator->shuntParentClassCalls(),
$template = new \mock\mageekguy\atoum\reports\template(uniqid())
$template = new \mock\atoum\atoum\reports\template(uniqid())
)
->if($this->newTestedInstance($name))
->then
Expand Down
Loading

0 comments on commit 5668fc6

Please sign in to comment.