You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
clean up code
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
.idea/
|
||||
vendor/
|
||||
.idea
|
||||
vendor
|
||||
composer.lock
|
||||
.phpunit.result.cache
|
||||
.phpcs-cache
|
||||
|
||||
@@ -26,23 +26,19 @@ final class Configuration implements ConfigurationInterface
|
||||
->arrayNode('scripts')
|
||||
->prototype('scalar')->end()
|
||||
->defaultValue(array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.10.2/sweetalert2.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/promise-polyfill/8.2.0/polyfill.min.js',
|
||||
'/bundles/flashersweetalert/flasher-sweet-alert.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js',
|
||||
'https://cdn.jsdelivr.net/npm/@flasher/flasher-sweet-alert@0.1.3/dist/flasher-sweet-alert.min.js',
|
||||
))
|
||||
->end()
|
||||
->arrayNode('styles')
|
||||
->prototype('scalar')->end()
|
||||
->defaultValue(array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.10.2/sweetalert2.min.css',
|
||||
))
|
||||
->defaultValue(array())
|
||||
->end()
|
||||
->arrayNode('options')
|
||||
->ignoreExtraKeys(false)
|
||||
->prototype('variable')->end()
|
||||
->defaultValue(array(
|
||||
'timer' => 50000,
|
||||
'timer' => 50000,
|
||||
'timerProgressBar' => true,
|
||||
))
|
||||
->end()
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
PHPFlasher.addFactory('sweet_alert', (function () {
|
||||
'use strict';
|
||||
|
||||
var exports = {};
|
||||
|
||||
exports.render = function (data) {
|
||||
var notification = data.notification;
|
||||
|
||||
window.SwalToast.fire(notification.options);
|
||||
};
|
||||
|
||||
exports.renderOptions = function (options) {
|
||||
if ("undefined" === typeof window.SwalToast) {
|
||||
window.SwalToast = Swal.mixin(options);
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
})());
|
||||
@@ -14,32 +14,13 @@ class ConfigurationTest extends TestCase
|
||||
|
||||
$expected = array(
|
||||
'scripts' => array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.10.2/sweetalert2.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/promise-polyfill/8.2.0/polyfill.min.js',
|
||||
'/bundles/flashersweetalert/flasher-sweet-alert.js',
|
||||
),
|
||||
'styles' => array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.10.2/sweetalert2.min.css',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js',
|
||||
'https://cdn.jsdelivr.net/npm/@flasher/flasher-sweet-alert@0.1.3/dist/flasher-sweet-alert.min.js',
|
||||
),
|
||||
'styles' => array(),
|
||||
'options' => array(
|
||||
'timer' => 5000,
|
||||
'padding' => '1.25rem',
|
||||
'showConfirmButton' => false,
|
||||
'showCloseButton' => false,
|
||||
'toast' => true,
|
||||
'position' => 'top-end',
|
||||
'timerProgressBar' => true,
|
||||
'animation' => true,
|
||||
'showClass' => array(
|
||||
'popup' => 'animate__animated animate__fadeInDown',
|
||||
),
|
||||
'hideClass' => array(
|
||||
'popup' => 'animate__animated animate__fadeOutUp',
|
||||
),
|
||||
'backdrop' => true,
|
||||
'grow' => true,
|
||||
'timer' => 50000,
|
||||
'timerProgressBar' => true,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -13,20 +13,14 @@ class FlasherSweetAlertExtensionTest extends TestCase
|
||||
{
|
||||
public function testContainerContainFlasherServices()
|
||||
{
|
||||
$container = $this->getRawContainer();
|
||||
$container->loadFromExtension('flasher', array());
|
||||
$container->loadFromExtension('flasher_sweet_alert', array());
|
||||
$container->compile();
|
||||
$container = $this->getContainer();
|
||||
|
||||
$this->assertTrue($container->has('flasher.sweet_alert'));
|
||||
}
|
||||
|
||||
public function testCreateInstanceOfSweetAlertAdapter()
|
||||
{
|
||||
$container = $this->getRawContainer();
|
||||
$container->loadFromExtension('flasher');
|
||||
$container->loadFromExtension('flasher_sweet_alert');
|
||||
$container->compile();
|
||||
$container = $this->getContainer();
|
||||
|
||||
$flasher = $container->getDefinition('flasher');
|
||||
$calls = $flasher->getMethodCalls();
|
||||
@@ -42,13 +36,6 @@ class FlasherSweetAlertExtensionTest extends TestCase
|
||||
$this->assertSame('flasher.sweet_alert', (string) $calls[1][1][1]);
|
||||
}
|
||||
|
||||
public function testConfigurationInjectedIntoFlasherConfig()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$config = $container->get('flasher.config');
|
||||
$this->assertNotEmpty($config->get('adapters.sweet_alert'));
|
||||
}
|
||||
|
||||
private function getRawContainer()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
@@ -71,6 +58,8 @@ class FlasherSweetAlertExtensionTest extends TestCase
|
||||
private function getContainer()
|
||||
{
|
||||
$container = $this->getRawContainer();
|
||||
$container->loadFromExtension('flasher', array());
|
||||
$container->loadFromExtension('flasher_sweet_alert', array());
|
||||
$container->compile();
|
||||
|
||||
return $container;
|
||||
|
||||
+2
-2
@@ -30,8 +30,8 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": ">=5.3",
|
||||
"php-flasher/flasher-symfony": "^0.1",
|
||||
"php-flasher/flasher-sweet-alert": "^0.1"
|
||||
"php-flasher/flasher-symfony": "@dev",
|
||||
"php-flasher/flasher-sweet-alert": "@dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0|^9.0"
|
||||
|
||||
Reference in New Issue
Block a user