Skip to content

Commit 9105d2c

Browse files
authored
Raise deps (#32)
* PHPUnit upgrade * Upgrade PHP and Symfony min versions * New PHP version upgrades * Add github workflow CI * Raise mockery min version * CI badge
1 parent c956e92 commit 9105d2c

12 files changed

Lines changed: 78 additions & 72 deletions

File tree

.coveralls.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "master"
7+
push:
8+
branches:
9+
- "master"
10+
11+
jobs:
12+
phpunit:
13+
name: "PHPUnit"
14+
runs-on: "ubuntu-20.04"
15+
16+
strategy:
17+
matrix:
18+
php-version:
19+
- "8.0"
20+
- "8.1"
21+
dependencies:
22+
- "highest"
23+
include:
24+
- php-version: "8.0"
25+
dependencies: "lowest"
26+
27+
steps:
28+
- name: "Checkout"
29+
uses: "actions/checkout@v2"
30+
with:
31+
fetch-depth: 2
32+
33+
- name: "Install PHP"
34+
uses: "shivammathur/setup-php@v2"
35+
with:
36+
php-version: "${{ matrix.php-version }}"
37+
coverage: "pcov"
38+
ini-values: "zend.assertions=1"
39+
40+
- name: "Install dependencies with Composer"
41+
uses: "ramsey/composer-install@v1"
42+
with:
43+
dependency-versions: "${{ matrix.dependencies }}"
44+
45+
- name: "Run PHPUnit"
46+
run: "vendor/bin/phpunit"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
vendor/*
22
/build
33
composer.lock
4+
.phpunit.result.cache
5+
docker-compose.yml
6+
Dockerfile

.travis.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

ConfigHelper.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
class ConfigHelper
99
{
10-
private $config;
11-
private $projectDir;
10+
private array $config;
11+
private string $projectDir;
1212

1313
public function __construct(string $projectDir, array $config)
1414
{
@@ -18,7 +18,7 @@ public function __construct(string $projectDir, array $config)
1818

1919
public function buildProcess(InputStream $input, array $arguments = [], array $env = []): Process
2020
{
21-
$process = new Process(
21+
return new Process(
2222
array_merge(
2323
[
2424
$this->config['script']['callable'],
@@ -30,7 +30,5 @@ public function buildProcess(InputStream $input, array $arguments = [], array $e
3030
array_merge($this->config['env_vars'], $env),
3131
$input
3232
);
33-
34-
return $process;
3533
}
3634
}

DependencyInjection/Configuration.php

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,24 @@
44

55
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
66
use Symfony\Component\Config\Definition\ConfigurationInterface;
7-
use Symfony\Component\HttpKernel\Kernel;
87

98
class Configuration implements ConfigurationInterface
109
{
1110
/**
12-
* {@inheritdoc}
11+
* {@inheritDoc}
1312
*/
14-
public function getConfigTreeBuilder()
13+
public function getConfigTreeBuilder(): TreeBuilder
1514
{
1615
$treeBuilder = new TreeBuilder('padam87_rasterize');
17-
$rootNode = method_exists($treeBuilder, 'getRootNode')
18-
? $treeBuilder->getRootNode()
19-
: $treeBuilder->root('padam87_rasterize');
2016

21-
$rootNode
17+
$treeBuilder->getRootNode()
2218
->children()
2319
->arrayNode('script')
2420
->addDefaultsIfNotSet()
2521
->children()
2622
->scalarNode('callable')->defaultValue('node')->end()
2723
->scalarNode('path')
28-
->defaultValue($this->getAssetsDir() . DIRECTORY_SEPARATOR . 'rasterize.js')
24+
->defaultValue('assets' . DIRECTORY_SEPARATOR . 'rasterize.js')
2925
->info('Relative to project dir')
3026
->end()
3127
->end()
@@ -54,14 +50,4 @@ public function getConfigTreeBuilder()
5450

5551
return $treeBuilder;
5652
}
57-
58-
private function getAssetsDir()
59-
{
60-
switch (Kernel::MAJOR_VERSION) {
61-
case 3:
62-
return 'web';
63-
default:
64-
return 'assets';
65-
}
66-
}
6753
}

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
[![Build Status](https://travis-ci.org/Padam87/RasterizeBundle.svg?branch=master)](https://travis-ci.org/Padam87/RasterizeBundle)
2-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Padam87/RasterizeBundle/badges/quality-score.png?s=dbb22e5306bff73f2b3494261ddb8d6d7c6b35d7)](https://scrutinizer-ci.com/g/Padam87/RasterizeBundle/)
3-
[![Coverage Status](https://coveralls.io/repos/Padam87/RasterizeBundle/badge.png)](https://coveralls.io/r/Padam87/RasterizeBundle)
4-
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/7e2ecf7a-40d7-41f4-9103-a99593c435d2/mini.png)](https://insight.sensiolabs.com/projects/7e2ecf7a-40d7-41f4-9103-a99593c435d2)
1+
![CI status](https://github.com/Padam87/RasterizerBundle/actions/workflows/ci.yaml/badge.svg)
52

63
[![License](https://poser.pugx.org/padam87/rasterize-bundle/license.png)](https://packagist.org/packages/padam87/rasterize-bundle)
74
[![Latest Stable Version](https://poser.pugx.org/padam87/rasterize-bundle/v/stable.png)](https://packagist.org/packages/padam87/rasterize-bundle)

Rasterizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
class Rasterizer
99
{
10-
protected $configHelper;
11-
protected $stopwatch;
10+
protected ConfigHelper $configHelper;
11+
protected ?Stopwatch $stopwatch;
1212

1313
public function __construct(ConfigHelper $configHelper, Stopwatch $stopwatch = null)
1414
{

Tests/ConfigHelperTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class ConfigHelperTest extends TestCase
1616
*/
1717
protected $config;
1818

19-
protected function tearDown()
19+
protected function tearDown(): void
2020
{
2121
m::close();
2222
}
2323

24-
public function setUp()
24+
public function setUp(): void
2525
{
2626
$this->config = [
2727
'script' => [

Tests/RasterizerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class RasterizerTest extends TestCase
1616
private $stopwatch;
1717
private $process;
1818

19-
protected function tearDown()
19+
protected function tearDown(): void
2020
{
2121
m::close();
2222
}
2323

24-
public function setUp()
24+
public function setUp(): void
2525
{
2626
$this->configHelper = m::mock(ConfigHelper::class);
2727
$this->stopwatch = m::mock(Stopwatch::class);

0 commit comments

Comments
 (0)