Skip to content
Open
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
32 changes: 12 additions & 20 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.setup }}-coverage-${{ matrix.php }}-

- name: Code Climate Test Reporter Preparation
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 before-build
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: |
Expand All @@ -57,15 +49,15 @@ jobs:
- name: Run test suite
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml --default-time-limit=3

- name: Code Climate Test Reporter
if: ${{ env.CC_TEST_REPORTER_ID != '' }}
run: |
cp coverage.xml clover.xml
bash <(curl -s https://codecov.io/bash)
./cc-test-reporter after-build --coverage-input-type clover --exit-code 0
composer config version 1.9.0
# composer require codacy/coverage
# vendor/bin/codacycoverage clover coverage.xml
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
# CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
- name: Coverage - Qltysh
uses: qltysh/qlty-action/coverage@v2
if: matrix.coverage
with:
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
files: clover.xml

- name: Coverage - Codecov
if: matrix.coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 1 addition & 2 deletions .github/workflows/multi-tester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
php: ['7.4', '8.2']
php: ['8.2', '8.4']
setup: ['stable']

name: PHP ${{ matrix.php }}
Expand All @@ -38,7 +38,6 @@ jobs:
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: |
composer config version 1.9.0
composer require kylekatarnls/multi-tester:^2.5.2 --dev --no-update --no-interaction
composer update --prefer-dist --prefer-${{ matrix.setup }} --no-progress --no-interaction

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
setup: ['lowest', 'stable', 'next']

name: PHP ${{ matrix.php }} - ${{ matrix.setup }}
Expand Down Expand Up @@ -41,7 +41,6 @@ jobs:
if: steps.composer-cache.outputs.cache-hit != 'true'
run: |
composer config version 1.9.0
${{ matrix.php >= 7.2 && matrix.php < 8 && matrix.setup == 'lowest' && 'composer require --no-update "phpunit/phpunit:^5.7.27||^6.5.14||^7.5.20" --no-interaction;' || '' }}
${{ matrix.php >= 8 && 'composer require --no-update phpunit/phpunit:^8.5.14 --no-interaction;' || '' }}
composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }} --no-interaction

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"nodejs-php-fallback/less": "^1.0.5",
"nodejs-php-fallback/stylus": "^1.0.4",
"nodejs-php-fallback/uglify": "^1.0.4",
"phpunit/phpunit": "^7.5.20 || ^8.5.41 || ^9.6.22",
"phpunit/phpunit": "^7.5.20 || ^8.5.52 || ^9.6.34",
"phpunit/php-code-coverage": "^6.1.4 || ^7.0.17 || ^9.2.32",
"phpunit/php-invoker": "^1.1.4 || ^3.1.1",
"pug-php/pug": "^3.4.1",
"pug-php/pug-filter-coffee-script": "^1.3.1",
"squizlabs/php_codesniffer": "^3.7.2"
"squizlabs/php_codesniffer": "^3.13.5"
},
"replace": {
"phug/ast": "self.version",
Expand Down
10 changes: 5 additions & 5 deletions src/Phug/Util/CompatibilityUtil/TestCaseUntyped.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ protected function finishTest()
// Override
}

protected function setUp()
protected function setUp(): void
{
$this->prepareTest();
}

protected function tearDown()
protected function tearDown(): void
{
$this->finishTest();
}

public static function assertMatchesRegularExpression($pattern, $string, $message = '')
public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void
{
if (!method_exists(parent::class, 'assertMatchesRegularExpression')) {
self::assertRegExp($pattern, $string, $message);
Expand All @@ -42,7 +42,7 @@ public static function assertMatchesRegularExpression($pattern, $string, $messag
parent::assertMatchesRegularExpression($pattern, $string, $message);
}

public static function assertFileDoesNotExist($filename, $message = '')
public static function assertFileDoesNotExist(string $filename, string $message = ''): void
{
if (!method_exists(parent::class, 'assertFileDoesNotExist')) {
self::assertFileNotExists($filename, $message);
Expand All @@ -53,7 +53,7 @@ public static function assertFileDoesNotExist($filename, $message = '')
parent::assertFileDoesNotExist($filename, $message);
}

public static function assertIsArray($actual, $message = '')
public static function assertIsArray($actual, string $message = ''): void
{
if (!method_exists(parent::class, 'assertIsArray')) {
self::assertSame('array', gettype($actual));
Expand Down
2 changes: 1 addition & 1 deletion tests/Phug/AbstractLexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function filterTokenClass($className)
}
}

protected function assertTokens($expression, array $classNames, Lexer $lexer = null, &$tokens = [])
protected function assertTokens($expression, array $classNames, ?Lexer $lexer = null, &$tokens = [])
{
$lexer = $lexer ?: $this->lexer;
$tokens = iterator_to_array($lexer->lex($expression));
Expand Down
2 changes: 1 addition & 1 deletion tests/Phug/AbstractParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected function prepareTest()
$this->parser = new Parser();
}

protected function assertNodes($expression, $expected, Parser $parser = null)
protected function assertNodes($expression, $expected, ?Parser $parser = null)
{
if (is_array($expected)) {
$expected = implode("\n", $expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class TestBlockNodeCompiler extends BlockNodeCompiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
$blocks = &$this->getCompiler()->getBlocksByName('foo');
$blocks[] = 'bar';
Expand Down
4 changes: 2 additions & 2 deletions tests/Phug/FormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,6 @@ public function testDebugErrorOnRemovedFile()

try {
include $file;
} catch (\Exception $exception) {
$error = $exception;
} catch (\Throwable $exception) {
$error = $exception;
}
Expand All @@ -1364,6 +1362,8 @@ public function testDebugErrorOnRemovedFile()
unlink($file);
clearstatcache();

self::assertInstanceOf(\Throwable::class, $error);

/** @var LocatedException $error */
$error = $formatter->getDebugError($error, $php);

Expand Down
2 changes: 2 additions & 0 deletions tests/Phug/RendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ public function testHandleErrorInString()
$message = $error->getMessage();
}

self::assertIsString($message);
self::assertStringContains(
'Division by zero',
$message
Expand Down Expand Up @@ -579,6 +580,7 @@ public function testContextLines()
$message = $error->getMessage();
}

self::assertIsString($message);
self::assertStringContains('Division by zero', $message);
self::assertStringContains('div: p=12/0', $message);
self::assertStringContains('// line -1', $message);
Expand Down
2 changes: 1 addition & 1 deletion tests/Phug/TestCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class TestCompiler extends Compiler
{
public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
return 'foo';
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Phug/TestState.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestState extends State
{
private static $lastOptions;

public function __construct(Parser $parser, \Generator $tokens, array $options = null)
public function __construct(Parser $parser, \Generator $tokens, ?array $options = null)
{
parent::__construct($parser, $tokens, $options);

Expand Down
2 changes: 1 addition & 1 deletion tests/Phug/Utils/MutedExceptionCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function throwException($message, $node = null, $code = 0, $previous = nu
// removed
}

public function compileNode(NodeInterface $node, ElementInterface $parent = null)
public function compileNode(NodeInterface $node, ?ElementInterface $parent = null)
{
return $this->forcedReturn ?: parent::compileNode($node, $parent);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Phug/Utils/TwigFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class TwigFormat extends XhtmlFormat
{
public function __construct(Formatter $formatter = null)
public function __construct(?Formatter $formatter = null)
{
parent::__construct($formatter);

Expand Down
Loading