Skip to content

Commit

Permalink
Laravel 11 Support (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 authored Feb 29, 2024
1 parent 6114e6c commit 71c58df
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@ jobs:
matrix:
os: [ubuntu-latest]
php: [8.2, 8.1, 8.0]
laravel: [10.*, 9.*, 8.*]
laravel: [11.*, 10.*, 9.*, 8.*]
dependency-version: [prefer-stable]
include:
- laravel: 11.*
testbench: 9.*
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: 6.*
exclude:
- laravel: 11.*
php: 8.1
- laravel: 11.*
php: 8.0
- laravel: 10.*
php: 8.0

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
],
"require": {
"php": "^8.0",
"illuminate/contracts": "^8.0|^9.0|^10.0",
"illuminate/support": "^8.0|^9.0|^10.0"
"illuminate/contracts": "^8.0|^9.0|^10.0|^11.0",
"illuminate/support": "^8.0|^9.0|^10.0|^11.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"orchestra/testbench": "^6.0|^7.0|^8.0",
"pestphp/pest": "^1.22"
"phpunit/phpunit": "^9.5|^10.5",
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
"pestphp/pest": "^1.22|^2.28"
},
"autoload": {
"psr-4": {
Expand Down
26 changes: 13 additions & 13 deletions tests/BladeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,43 @@
})
->with([
'an array' => [
'parameter' => fn () => ['key' => 'value'],
'parameter' => ['key' => 'value'],
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'key\'] = \'value\';</script>',
],
'a boolean with value of `true`' => [
'parameter' => fn () => ['boolean' => true],
'parameter' => ['boolean' => true],
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'boolean\'] = true;</script>',
],
'a boolean with value of `false`' => [
'parameter' => fn () => ['boolean' => false],
'parameter' => ['boolean' => false],
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'boolean\'] = false;</script>',
],
'an integer' => [
'parameter' => fn () => ['number' => 5],
'parameter' => ['number' => 5],
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'number\'] = 5;</script>',
],
'an float' => [
'parameter' => fn () => ['number' => 5.5],
'parameter' => ['number' => 5.5],
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'number\'] = 5.5;</script>',
],
'null' => [
'parameter' => fn () => ['nothing' => null],
'parameter' => ['nothing' => null],
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'nothing\'] = null;</script>',
],
'a string with line breaks' => [
'parameter' => fn () => ['string' => "This is\r\n a test"],
'parameter' => ['string' => "This is\r\n a test"],
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'string\'] = \'This is\\r\\n a test\';</script>',
],
'a numeric string as a string' => [
'parameter' => fn () => ['socialSecurity' => '123456789'],
'parameter' => ['socialSecurity' => '123456789'],
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'socialSecurity\'] = \'123456789\';</script>',
],
'escapes tags in a string' => [
'parameter' => fn () => ['string' => "This is a <tag>"],
'parameter' => ['string' => "This is a <tag>"],
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'string\'] = \'This is a \<tag\>\';</script>',
],
'arrayable objects' => [
'parameter' => fn () => new class () implements Arrayable {
'parameter' => new class () implements Arrayable {
public function toArray()
{
return ['arrayableKey' => 'arrayableValue'];
Expand All @@ -58,7 +58,7 @@ public function toArray()
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'arrayableKey\'] = \'arrayableValue\';</script>',
],
'JSON serializable objects' => [
'parameter' => fn () => new class () implements JsonSerializable {
'parameter' => new class () implements JsonSerializable {
public function jsonSerialize()
{
return ['jsonKey' => 'jsonValue'];
Expand All @@ -67,7 +67,7 @@ public function jsonSerialize()
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'0\'] = {"jsonKey":"jsonValue"};</script>',
],
'an object that implements `toJson`' => [
'parameter' => fn () => new class () {
'parameter' => new class () {
public function toJson()
{
return json_encode(['jsonKey' => 'jsonValue']);
Expand All @@ -76,7 +76,7 @@ public function toJson()
'expected' => '<script>window[\'js\'] = window[\'js\'] || {};window[\'js\'][\'0\'] = {"jsonKey":"jsonValue"};</script>',
],
'an object that implements `toString`' => [
'parameter' => fn () => new class () {
'parameter' => new class () {
public function __toString()
{
return 'string';
Expand Down

0 comments on commit 71c58df

Please sign in to comment.