Skip to content

Commit d58acb3

Browse files
authored
Merge pull request #13 from mirko-bukilic/master
Updated package and dependencies to php 8.3
2 parents 086ae38 + a716c2f commit d58acb3

11 files changed

Lines changed: 51 additions & 45 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ composer.phar
1717
composer.lock
1818
vendor
1919
test/coverage
20+
tests/unit/.phpunit.result.cache
2021

2122
# Compiled source #
2223
###################

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,20 @@
2525
"psr-4": {"G4\\Runner\\": "src/"}
2626
},
2727
"require": {
28-
"php" : ">=8.2",
28+
"php" : ">=8.3",
2929
"aura/accept" : "4.*",
3030
"g4/clean-core" : "*",
3131
"g4/http" : "*",
3232
"g4/di" : "*",
3333
"g4/profiler" : ">=1.12.0",
3434
"g4/factory" : "1.*",
35-
"twig/twig" : "1.*",
36-
"twig/extensions": "^1.2",
37-
"g4/version": "^0.0.2"
35+
"twig/twig" : "*",
36+
"g4/version": "0.0.*"
3837
},
3938
"require-dev": {
40-
"phpunit/phpunit" : "10.*",
39+
"phpunit/phpunit" : "9.*",
4140
"squizlabs/php_codesniffer" : "3.*",
42-
"g4/code-coverage" : "1.*"
41+
"g4/code-coverage" : "2.*"
4342
},
4443
"scripts": {
4544
"unit-test": [

src/Presenter/View/Twig/Template.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
namespace G4\Runner\Presenter\View\Twig;
44

5+
use G4\Runner\Presenter\DataTransfer;
6+
use Twig\Environment;
7+
use Twig\Loader\FilesystemLoader;
8+
59
class Template
610
{
711

@@ -12,7 +16,7 @@ class Template
1216

1317
/**
1418
*
15-
* @var \Twig_Environment
19+
* @var Environment
1620
*/
1721
private $templateEngine;
1822

@@ -42,37 +46,34 @@ public function render($data, $templateName)
4246
}
4347

4448
return $this->getTemplateEngine()
45-
->loadTemplate($templateName)
46-
->render($data);
49+
->render($templateName, $data);
4750
}
4851

4952
/**
50-
* @return \Twig_Loader_Filesystem
53+
* @return FilesystemLoader
5154
*/
5255
private function getFilesystemLoader()
5356
{
54-
return new \Twig_Loader_Filesystem([$this->templatesPath, $this->templatesRootPath]);
57+
return new FilesystemLoader([$this->templatesPath, $this->templatesRootPath]);
5558
}
5659

5760
/**
58-
* @return \Twig_Environment
61+
* @return Environment
5962
*/
6063
private function getTemplateEngine()
6164
{
62-
if(!$this->templateEngine instanceof \Twig_Environment) {
65+
if(!$this->templateEngine instanceof Environment) {
6366
if(is_callable(['\App\DI', 'templateEngine'])) {
6467
$this->templateEngine = \App\DI::templateEngine();
65-
if(!$this->templateEngine instanceof \Twig_Environment) {
68+
if(!$this->templateEngine instanceof Environment) {
6669
throw new \Exception("Template engine class is invalid");
6770
}
6871
} else {
69-
$this->templateEngine = new \Twig_Environment($this->getFilesystemLoader(), [
72+
$this->templateEngine = new Environment($this->getFilesystemLoader(), [
7073
'cache' => realpath(PATH_CACHE),
7174
'auto_reload' => true,
7275
'debug' => true,
7376
]);
74-
$this->templateEngine->addExtension(new \Twig_Extensions_Extension_I18n());
75-
$this->templateEngine->addExtension(new \Twig_Extension_Debug());
7677
}
7778
}
7879

tests/unit/phpunit.xml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
<phpunit bootstrap="bootstrap.php" colors="true">
2-
3-
<testsuite name="Test Suite">
4-
<directory>./src</directory>
5-
</testsuite>
6-
7-
<filter>
8-
<whitelist>
9-
<directory suffix=".php">../../src/</directory>
10-
</whitelist>
11-
</filter>
12-
13-
</phpunit>
1+
<?xml version="1.0"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">../../src/</directory>
6+
</include>
7+
</coverage>
8+
<testsuite name="Test Suite">
9+
<directory>./src</directory>
10+
</testsuite>
11+
</phpunit>

tests/unit/src/Presenter/ContentTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
use G4\Runner\Presenter\HeaderAccept;
55
use G4\Runner\Presenter\ContentType;
66
use G4\CleanCore\Response\Response;
7+
use PHPUnit\Framework\TestCase;
78

8-
class ContentTypeTest extends PHPUnit_Framework_TestCase
9+
class ContentTypeTest extends TestCase
910
{
1011
/**
1112
* @dataProvider validDataProvider

tests/unit/src/Presenter/HeaderAcceptTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33

44
use G4\Runner\Presenter\HeaderAccept;
5+
use PHPUnit\Framework\TestCase;
56

67

7-
class HeaderAcceptTest extends PHPUnit_Framework_TestCase
8+
class HeaderAcceptTest extends TestCase
89
{
910

1011
public function testDefault()

tests/unit/src/Presenter/View/ImageTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
use G4\Runner\Presenter\DataTransfer;
44
use G4\Runner\Presenter\View\Image;
55
use G4\CleanCore\Response\Response;
6+
use PHPUnit\Framework\TestCase;
67

7-
class ImageTest extends PHPUnit_Framework_TestCase
8+
class ImageTest extends TestCase
89
{
910
/**
1011
* @var Image
@@ -31,7 +32,7 @@ class ImageTest extends PHPUnit_Framework_TestCase
3132
/**
3233
* Set up method
3334
*/
34-
public function setUp()
35+
public function setUp(): void
3536
{
3637
$this->dataTransfer = $this->createMock(DataTransfer::class);
3738
$this->response = $this->createMock(Response::class);

tests/unit/src/Presenter/ViewTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
use G4\Runner\Presenter\View;
55
use G4\Runner\Presenter\ContentType;
66
use G4\CleanCore\Response\Response;
7+
use PHPUnit\Framework\TestCase;
78

8-
class ViewTest extends PHPUnit_Framework_TestCase
9+
class ViewTest extends TestCase
910
{
1011
/**
1112
* @var View
@@ -32,7 +33,7 @@ class ViewTest extends PHPUnit_Framework_TestCase
3233
/**
3334
* Set up method
3435
*/
35-
public function setUp()
36+
public function setUp(): void
3637
{
3738
$this->contentType = $this->createMock(ContentType::class);
3839
$this->dataTransfer = $this->createMock(DataTransfer::class);

tests/unit/src/Route/RouteFactoryTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace G4\Runner\Route;
44

5-
class RouteFactoryTest extends \PHPUnit_Framework_TestCase
5+
use PHPUnit\Framework\TestCase;
6+
7+
class RouteFactoryTest extends TestCase
68
{
79
public function testReconstitute()
810
{

tests/unit/src/Route/RouteFormatterTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
namespace G4\Runner\Route;
44

55
use G4\ValueObject\StringLiteral;
6+
use PHPUnit\Framework\TestCase;
67

7-
class RouteFormatterTest extends \PHPUnit_Framework_TestCase
8+
class RouteFormatterTest extends TestCase
89
{
910
public function testFormat()
1011
{

0 commit comments

Comments
 (0)