Skip to content

Commit

Permalink
chore(deps): downgrade to phpunit 9
Browse files Browse the repository at this point in the history
Because:
We need to support PHP 7.4 until we fully upgrade every app
  • Loading branch information
paulredmond committed Dec 20, 2023
1 parent f0e44cb commit 47abcf7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"slim/slim": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^10.0"
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": {
Expand Down
24 changes: 15 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
cacheResultFile=".phpunit.cache/test-results"
colors="true"
executionOrder="depends,defects"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="true"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true">
failOnWarning="true"
verbose="true"
>
<testsuites>
<testsuite name="Slim Test Suite">
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true">
<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory>src</directory>
<directory suffix=".php">src</directory>
</include>
</source>
</coverage>
</phpunit>
12 changes: 12 additions & 0 deletions tests/SmartyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public function setUp(): void
$this->view->addSlimPlugins($mockRouter, 'base_url_test');
}

/**
* @covers \Slim\Views\Smarty::fetch
*/
public function testFetch()
{
$output = $this->view->fetch('hello.tpl', [
Expand All @@ -34,6 +37,9 @@ public function testFetch()
$this->assertEquals("<p>Hello, my name is Matheus.</p>\n", $output);

Check failure on line 37 in tests/SmartyTest.php

View workflow job for this annotation

GitHub Actions / P8.1 - prefer-lowest - windows-latest

Failed asserting that two strings are equal.

Check failure on line 37 in tests/SmartyTest.php

View workflow job for this annotation

GitHub Actions / P7.4 - prefer-lowest - windows-latest

Failed asserting that two strings are equal.
}

/**
* @covers \Slim\Views\Smarty::render
*/
public function testRender()
{
$mockBody = $this->getMockBuilder('Psr\Http\Message\StreamInterface')
Expand All @@ -59,13 +65,19 @@ public function testRender()
$this->assertInstanceOf('Psr\Http\Message\ResponseInterface', $response);
}

/**
* @covers \Slim\Views\Smarty::fetch
*/
public function testPlugin()
{
$output = $this->view->fetch('plugin.tpl');

$this->assertEquals("<p>Plugin return: base_url_test.</p>\n", $output);

Check failure on line 75 in tests/SmartyTest.php

View workflow job for this annotation

GitHub Actions / P8.1 - prefer-lowest - windows-latest

Failed asserting that two strings are equal.

Check failure on line 75 in tests/SmartyTest.php

View workflow job for this annotation

GitHub Actions / P7.4 - prefer-lowest - windows-latest

Failed asserting that two strings are equal.
}

/**
* @covers \Slim\Views\Smarty::getSmarty
*/
public function testPluginDirs()
{
$this->assertGreaterThanOrEqual(2, count($this->view->getSmarty()->getPluginsDir()));
Expand Down

0 comments on commit 47abcf7

Please sign in to comment.