Skip to content

Commit 5c9e60c

Browse files
authored
Merge pull request #1 from leafsphp/update-blade-version-to-latest
2 parents 181e44b + b1152ec commit 5c9e60c

File tree

10 files changed

+708
-148
lines changed

10 files changed

+708
-148
lines changed

.github/workflows/tests.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run Tests
2+
3+
on: ['push', 'pull_request']
4+
5+
jobs:
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
os: [ubuntu-latest]
12+
php: [8.3, 8.2, 8.1, 8.0, 7.4]
13+
14+
name: PHP ${{ matrix.php }} – ${{ matrix.os }}
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
tools: composer:v2
25+
coverage: xdebug
26+
27+
- name: Install dependencies
28+
run: composer update --prefer-stable --no-interaction
29+
30+
- name: All tests
31+
run: php vendor/bin/pest --colors=always --coverage

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/vendor
22
composer.lock
33
.DS_Store
4+
.idea
5+
.phpunit.result.cache

.travis.yml

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

composer.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=7.0",
17-
"illuminate/view": "^5.5|^6.0|^7.0|^8.0"
16+
"php": ">=7.3|^8.0",
17+
"illuminate/view": "^8.0|^9.0|^10.0"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "^6.0|^7.0",
21-
"satooshi/php-coveralls": "^1.0"
20+
"pestphp/pest": "^1.0|^2.25"
2221
},
2322
"autoload": {
2423
"psr-4": {
2524
"Leaf\\": "src/"
2625
}
2726
},
2827
"minimum-stability": "dev",
29-
"prefer-stable": true
28+
"prefer-stable": true,
29+
"config": {
30+
"allow-plugins": {
31+
"pestphp/pest-plugin": true
32+
}
33+
}
3034
}

phpunit.xml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false">
6+
>
117
<testsuites>
12-
<testsuite name="Default">
13-
<directory>./tests/</directory>
8+
<testsuite name="Test Suite">
9+
<directory suffix="Test.php">./tests</directory>
1410
</testsuite>
1511
</testsuites>
16-
<filter>
17-
<whitelist addUncoveredFilesFromWhitelist="false">
18-
<directory suffix=".php">src/</directory>
19-
</whitelist>
20-
</filter>
12+
<source>
13+
<include>
14+
<directory suffix=".php">./app</directory>
15+
<directory suffix=".php">./src</directory>
16+
</include>
17+
</source>
2118
</phpunit>

src/Blade.php

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

33
namespace Leaf;
44

5-
use Illuminate\Container\Container;
65
use Illuminate\Contracts\Container\Container as ContainerInterface;
7-
use Illuminate\Contracts\Foundation\Application;
86
use Illuminate\Contracts\View\Factory as FactoryContract;
97
use Illuminate\Contracts\View\View;
108
use Illuminate\Events\Dispatcher;
@@ -17,7 +15,7 @@
1715
class Blade implements FactoryContract
1816
{
1917
/**
20-
* @var Application
18+
* @var BladeContainer
2119
*/
2220
protected $container;
2321

@@ -33,7 +31,7 @@ class Blade implements FactoryContract
3331

3432
public function __construct($viewPaths = null, string $cachePath = null, ContainerInterface $container = null)
3533
{
36-
$this->container = $container ?: new Container;
34+
$this->container = $container ?: new \Leaf\BladeContainer();
3735

3836
if ($viewPaths != null && $cachePath != null) {
3937
$this->configure($viewPaths, $cachePath);
@@ -54,8 +52,8 @@ public function configure($viewPaths, $cachePath)
5452

5553
/**
5654
* Render your blade template,
57-
*
58-
* A shorter version of the original `make` command.
55+
*
56+
* A shorter version of the original `make` command.
5957
* You can optionally pass data into the view as a second parameter
6058
*/
6159
public function render(string $view, array $data = [], array $mergeData = []): string
@@ -65,7 +63,7 @@ public function render(string $view, array $data = [], array $mergeData = []): s
6563

6664
/**
6765
* Render your blade template,
68-
*
66+
*
6967
* You can optionally pass data into the view as a second parameter.
7068
* Don't forget to chain the `render` method
7169
*/
@@ -147,10 +145,10 @@ protected function setupContainer(array $viewPaths, string $cachePath)
147145
}, true);
148146

149147
$this->container->bindIf('config', function () use ($viewPaths, $cachePath) {
150-
return [
148+
return new Config([
151149
'view.paths' => $viewPaths,
152150
'view.compiled' => $cachePath,
153-
];
151+
]);
154152
}, true);
155153

156154
Facade::setFacadeApplication($this->container);

0 commit comments

Comments
 (0)