fix tests for laravel 5.1

This commit is contained in:
Khoubza Younes
2020-12-13 12:58:35 +01:00
parent f07c999c9a
commit 7bc1924269
5 changed files with 47 additions and 3 deletions
+2 -2
View File
@@ -14,7 +14,7 @@
"require": {
"php": ">=5.3",
"ext-json": "*",
"illuminate/support": "5.0.*"
"illuminate/support": "5.1.*"
},
"require-dev": {
"phpunit/phpunit": "4.8.*",
@@ -30,7 +30,7 @@
},
"config": {
"platform": {
"php": "5.4.0"
"php": "5.5.9"
}
},
"minimum-stability": "dev"
+10
View File
@@ -59,6 +59,16 @@
<testsuite name="flasher pnotify symfony">
<directory>src/Pnotify/Symfony</directory>
</testsuite>
<testsuite name="flasher noty">
<directory>src/Noty/Prime</directory>
</testsuite>
<testsuite name="flasher noty laravel">
<directory>src/Noty/Laravel</directory>
</testsuite>
<testsuite name="flasher noty symfony">
<directory>src/Noty/Symfony</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
@@ -112,10 +112,23 @@ class Laravel implements ServiceProviderInterface
public function registerBladeDirectives()
{
Blade::directive('flasher_render', function ($criteria = array()) {
$startsWith = function($haystack, $needle) {
return substr_compare($haystack, $needle, 0, strlen($needle)) === 0;
};
$endsWith = function($haystack, $needle) {
return substr_compare($haystack, $needle, -strlen($needle)) === 0;
};
Blade::directive('flasher_render', function ($criteria = array()) use($startsWith, $endsWith) {
if (!empty($criteria) && $startsWith($criteria, "(") && $endsWith($criteria, ")")) {
$criteria = substr($criteria, 1, -1);
}
if (empty($criteria)) {
$criteria = "array()";
}
return "<?php echo app('flasher.renderer')->render($criteria, 'html'); ?>";
});
}
@@ -0,0 +1,20 @@
<?php
namespace Flasher\Laravel\ServiceProvider\Providers;
use Flasher\Laravel\FlasherServiceProvider;
use Illuminate\Foundation\Application;
final class Laravel51 extends Laravel
{
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '5.1');
}
public function publishTranslations(FlasherServiceProvider $provider)
{
$provider->loadTranslationsFrom(flasher_path(__DIR__.'/../../Resources/lang'), 'flasher');
$provider->publishes(array(flasher_path(__DIR__.'/../../Resources/lang') => base_path(flasher_path('resources/lang/vendor/flasher'))));
}
}
@@ -15,6 +15,7 @@ final class ServiceProviderManager
private $providers = array(
'Flasher\Laravel\ServiceProvider\Providers\Laravel4',
'Flasher\Laravel\ServiceProvider\Providers\Laravel50',
'Flasher\Laravel\ServiceProvider\Providers\Laravel51',
'Flasher\Laravel\ServiceProvider\Providers\Laravel',
'Flasher\Laravel\ServiceProvider\Providers\Lumen',
);