@@ -72,7 +72,7 @@ |
||
| 72 | 72 | // and the other classes will get this request from there. |
| 73 | 73 | $this->di->val(ServerRequestInterface::class, $request); |
| 74 | 74 | |
| 75 | - if(!$this->xRequestHandler->canProcessRequest()) |
|
| 75 | + if (!$this->xRequestHandler->canProcessRequest()) |
|
| 76 | 76 | { |
| 77 | 77 | // Unable to find a plugin to process the request |
| 78 | 78 | throw new RequestException($this->xTranslator->trans('errors.request.plugin')); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function popBootCallbacks(): array |
| 100 | 100 | { |
| 101 | - if(empty($this->aBootCallbacks)) |
|
| 101 | + if (empty($this->aBootCallbacks)) |
|
| 102 | 102 | { |
| 103 | 103 | return []; |
| 104 | 104 | } |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | private function getExceptionCallbacks(Exception $xException): array |
| 118 | 118 | { |
| 119 | 119 | $aExceptionCallbacks = []; |
| 120 | - foreach($this->aExceptionCallbacks as $sExClass => $aCallbacks) |
|
| 120 | + foreach ($this->aExceptionCallbacks as $sExClass => $aCallbacks) |
|
| 121 | 121 | { |
| 122 | - if(is_a($xException, $sExClass)) |
|
| 122 | + if (is_a($xException, $sExClass)) |
|
| 123 | 123 | { |
| 124 | 124 | $aExceptionCallbacks = array_merge($aExceptionCallbacks, $aCallbacks); |
| 125 | 125 | } |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function error(callable $xCallable, string $sExClass = ''): CallbackManager |
| 191 | 191 | { |
| 192 | - if($sExClass === '' || $sExClass === Exception::class) |
|
| 192 | + if ($sExClass === '' || $sExClass === Exception::class) |
|
| 193 | 193 | { |
| 194 | 194 | $this->aErrorCallbacks[] = $xCallable; |
| 195 | 195 | return $this; |
| 196 | 196 | } |
| 197 | 197 | // Callback for a given exception class |
| 198 | - if(isset($this->aExceptionCallbacks[$sExClass])) |
|
| 198 | + if (isset($this->aExceptionCallbacks[$sExClass])) |
|
| 199 | 199 | { |
| 200 | 200 | $this->aExceptionCallbacks[$sExClass][] = $xCallable; |
| 201 | 201 | return $this; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | private function executeCallbacks(array $aCallbacks, array $aParameters): void |
| 238 | 238 | { |
| 239 | - foreach($aCallbacks as $xCallback) |
|
| 239 | + foreach ($aCallbacks as $xCallback) |
|
| 240 | 240 | { |
| 241 | 241 | $this->executeCallback($xCallback, $aParameters); |
| 242 | 242 | } |
@@ -266,10 +266,10 @@ discard block |
||
| 266 | 266 | public function onBefore(Target $xTarget, bool &$bEndRequest): void |
| 267 | 267 | { |
| 268 | 268 | // Call the user defined callback |
| 269 | - foreach($this->aBeforeCallbacks as $xCallback) |
|
| 269 | + foreach ($this->aBeforeCallbacks as $xCallback) |
|
| 270 | 270 | { |
| 271 | 271 | $this->executeCallback($xCallback, [$xTarget, &$bEndRequest]); |
| 272 | - if($bEndRequest) |
|
| 272 | + if ($bEndRequest) |
|
| 273 | 273 | { |
| 274 | 274 | return; |
| 275 | 275 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | $aExceptionCallbacks = $this->getExceptionCallbacks($xException); |
| 318 | 318 | $this->executeCallbacks($aExceptionCallbacks, [$xException]); |
| 319 | - if(count($aExceptionCallbacks) > 0) |
|
| 319 | + if (count($aExceptionCallbacks) > 0) |
|
| 320 | 320 | { |
| 321 | 321 | // Do not throw the exception if a custom handler is defined |
| 322 | 322 | return; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public function canProcessRequest(): bool |
| 62 | 62 | { |
| 63 | 63 | // Return true if the request plugin was already found |
| 64 | - if($this->xRequestPlugin !== null) |
|
| 64 | + if ($this->xRequestPlugin !== null) |
|
| 65 | 65 | { |
| 66 | 66 | return true; |
| 67 | 67 | } |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | $xRequest = $this->di->getRequest(); |
| 71 | 71 | |
| 72 | 72 | // Find a plugin to process the request |
| 73 | - foreach($this->xPluginManager->getRequestHandlers() as $sClassName) |
|
| 73 | + foreach ($this->xPluginManager->getRequestHandlers() as $sClassName) |
|
| 74 | 74 | { |
| 75 | - if($sClassName::canProcessRequest($xRequest)) |
|
| 75 | + if ($sClassName::canProcessRequest($xRequest)) |
|
| 76 | 76 | { |
| 77 | 77 | $this->xRequestPlugin = $this->di->g($sClassName); |
| 78 | 78 | $xTarget = $this->xRequestPlugin->setTarget($xRequest); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | private function _processRequest(): void |
| 93 | 93 | { |
| 94 | 94 | // Process the request |
| 95 | - if($this->xRequestPlugin !== null) |
|
| 95 | + if ($this->xRequestPlugin !== null) |
|
| 96 | 96 | { |
| 97 | 97 | $this->xRequestPlugin->processRequest(); |
| 98 | 98 | // Process the databag |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | public function processRequest(): void |
| 110 | 110 | { |
| 111 | 111 | // Check if there is a plugin to process this request |
| 112 | - if(!$this->canProcessRequest()) |
|
| 112 | + if (!$this->canProcessRequest()) |
|
| 113 | 113 | { |
| 114 | 114 | return; |
| 115 | 115 | } |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $bEndRequest = false; |
| 120 | 120 | // Handle before processing event |
| 121 | - if($this->xRequestPlugin !== null) |
|
| 121 | + if ($this->xRequestPlugin !== null) |
|
| 122 | 122 | { |
| 123 | 123 | $this->xCallbackManager->onBefore($this->xRequestPlugin->getTarget(), $bEndRequest); |
| 124 | 124 | } |
| 125 | - if($bEndRequest) |
|
| 125 | + if ($bEndRequest) |
|
| 126 | 126 | { |
| 127 | 127 | return; |
| 128 | 128 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $this->_processRequest(); |
| 131 | 131 | |
| 132 | 132 | // Handle after processing event |
| 133 | - if($this->xRequestPlugin !== null) |
|
| 133 | + if ($this->xRequestPlugin !== null) |
|
| 134 | 134 | { |
| 135 | 135 | $this->xCallbackManager->onAfter($this->xRequestPlugin->getTarget(), $bEndRequest); |
| 136 | 136 | } |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | // An exception was thrown while processing the request. |
| 139 | 139 | // The request missed the corresponding handler function, |
| 140 | 140 | // or an error occurred while attempting to execute the handler. |
| 141 | - catch(RequestException $e) |
|
| 141 | + catch (RequestException $e) |
|
| 142 | 142 | { |
| 143 | 143 | $this->xResponseManager->error($e->getMessage()); |
| 144 | 144 | $this->xCallbackManager->onInvalid($e); |
| 145 | 145 | } |
| 146 | - catch(Exception $e) |
|
| 146 | + catch (Exception $e) |
|
| 147 | 147 | { |
| 148 | 148 | $this->xResponseManager->error($e->getMessage()); |
| 149 | 149 | $this->xCallbackManager->onError($e); |
@@ -142,8 +142,7 @@ |
||
| 142 | 142 | { |
| 143 | 143 | $this->xResponseManager->error($e->getMessage()); |
| 144 | 144 | $this->xCallbackManager->onInvalid($e); |
| 145 | - } |
|
| 146 | - catch(Exception $e) |
|
| 145 | + } catch(Exception $e) |
|
| 147 | 146 | { |
| 148 | 147 | $this->xResponseManager->error($e->getMessage()); |
| 149 | 148 | $this->xCallbackManager->onError($e); |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | private function decoderUtf8Str(string $sStr): string |
| 81 | 81 | { |
| 82 | 82 | $sEncoding = $this->xConfigManager->getOption('core.encoding', ''); |
| 83 | - if(function_exists('iconv')) |
|
| 83 | + if (function_exists('iconv')) |
|
| 84 | 84 | { |
| 85 | 85 | return iconv("UTF-8", $sEncoding . '//TRANSLIT', $sStr); |
| 86 | 86 | } |
| 87 | - if(function_exists('mb_convert_encoding')) |
|
| 87 | + if (function_exists('mb_convert_encoding')) |
|
| 88 | 88 | { |
| 89 | 89 | return mb_convert_encoding($sStr, $sEncoding, "UTF-8"); |
| 90 | 90 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | private function decodeRequestParameter(string $sParam): string |
| 104 | 104 | { |
| 105 | 105 | $sParam = $this->decodeStr($sParam); |
| 106 | - if(!$this->xConfigManager->getOption('core.decode_utf8')) |
|
| 106 | + if (!$this->xConfigManager->getOption('core.decode_utf8')) |
|
| 107 | 107 | { |
| 108 | 108 | return $sParam; |
| 109 | 109 | } |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function withPage(): self |
| 33 | 33 | { |
| 34 | - foreach($this->aArguments as $xArgument) |
|
| 34 | + foreach ($this->aArguments as $xArgument) |
|
| 35 | 35 | { |
| 36 | - if(TypedValue::isPage($xArgument)) |
|
| 36 | + if (TypedValue::isPage($xArgument)) |
|
| 37 | 37 | { |
| 38 | 38 | return $this; |
| 39 | 39 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $sName = trim($sPath) ?: 'this'; |
| 27 | 27 | $this->aCall = ['_type' => 'select', '_name' => $sName, 'mode' => $sMode]; |
| 28 | - if($sName !== 'this' && $xContext !== null) |
|
| 28 | + if ($sName !== 'this' && $xContext !== null) |
|
| 29 | 29 | { |
| 30 | 30 | $this->aCall['context'] = is_a($xContext, JsonSerializable::class) ? |
| 31 | 31 | $xContext->jsonSerialize() : $xContext; |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function func(): ?Func |
| 91 | 91 | { |
| 92 | - foreach($this->aCalls as $xCall) |
|
| 92 | + foreach ($this->aCalls as $xCall) |
|
| 93 | 93 | { |
| 94 | - if(is_a($xCall, Func::class)) |
|
| 94 | + if (is_a($xCall, Func::class)) |
|
| 95 | 95 | { |
| 96 | 96 | return $xCall; |
| 97 | 97 | } |
@@ -426,15 +426,15 @@ discard block |
||
| 426 | 426 | 'calls' => array_map(fn(JsonSerializable|array $xCall) => |
| 427 | 427 | is_array($xCall) ? $xCall : $xCall->jsonSerialize(), $this->aCalls), |
| 428 | 428 | ]; |
| 429 | - if(($this->aConfirm)) |
|
| 429 | + if (($this->aConfirm)) |
|
| 430 | 430 | { |
| 431 | 431 | $aJsExpr['confirm'] = $this->aConfirm; |
| 432 | 432 | } |
| 433 | - if(($this->aCondition)) |
|
| 433 | + if (($this->aCondition)) |
|
| 434 | 434 | { |
| 435 | 435 | $aJsExpr['condition'] = $this->aCondition; |
| 436 | 436 | } |
| 437 | - if(($this->aAlert)) |
|
| 437 | + if (($this->aAlert)) |
|
| 438 | 438 | { |
| 439 | 439 | $aJsExpr['alert'] = $this->aAlert; |
| 440 | 440 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function __get(string $sAttribute): JsExpr |
| 60 | 60 | { |
| 61 | - return $this->_expr()->__get( $sAttribute); |
|
| 61 | + return $this->_expr()->__get($sAttribute); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -24,383 +24,383 @@ |
||
| 24 | 24 | |
| 25 | 25 | class SetupTest extends TestCase |
| 26 | 26 | { |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * @throws SetupException |
| 29 | 29 | */ |
| 30 | - public function setUp(): void |
|
| 31 | - { |
|
| 32 | - _register(); |
|
| 33 | - jaxon()->setOption('core.prefix.class', ''); |
|
| 34 | - jaxon()->setOption('core.request.uri', 'http://example.test/path'); |
|
| 35 | - jaxon()->register(Jaxon::CALLABLE_CLASS, Dialog::class); |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - /** |
|
| 30 | +public function setUp(): void |
|
| 31 | +{ |
|
| 32 | +_register(); |
|
| 33 | +jaxon()->setOption('core.prefix.class', ''); |
|
| 34 | +jaxon()->setOption('core.request.uri', 'http://example.test/path'); |
|
| 35 | +jaxon()->register(Jaxon::CALLABLE_CLASS, Dialog::class); |
|
| 36 | +} |
|
| 37 | + |
|
| 38 | +/** |
|
| 39 | 39 | * @throws SetupException |
| 40 | 40 | */ |
| 41 | - public function tearDown(): void |
|
| 42 | - { |
|
| 43 | - jaxon()->reset(); |
|
| 44 | - parent::tearDown(); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - public function testDialogSettings() |
|
| 48 | - { |
|
| 49 | - $this->assertEquals('', dialog()->getConfirmLibrary()->getName()); |
|
| 50 | - $this->assertEquals(Alert::class, get_class(dialog()->getConfirmLibrary())); |
|
| 51 | - $this->assertEquals(Alert::class, get_class(dialog()->getAlertLibrary())); |
|
| 52 | - $this->assertEquals(null, dialog()->getModalLibrary()); |
|
| 53 | - |
|
| 54 | - jaxon()->setAppOptions([ |
|
| 55 | - 'modal' => 'alertify', |
|
| 56 | - 'alert' => 'alertify', |
|
| 57 | - 'confirm' => 'alertify', |
|
| 58 | - ], 'dialogs.default'); |
|
| 59 | - $this->assertEquals(Alertify::class, get_class(dialog()->getConfirmLibrary())); |
|
| 60 | - $this->assertEquals(Alertify::class, get_class(dialog()->getAlertLibrary())); |
|
| 61 | - $this->assertEquals(Alertify::class, get_class(dialog()->getModalLibrary())); |
|
| 62 | - |
|
| 63 | - jaxon()->setAppOptions([ |
|
| 64 | - 'modal' => 'bootbox', |
|
| 65 | - 'alert' => 'bootbox', |
|
| 66 | - 'confirm' => 'bootbox', |
|
| 67 | - ], 'dialogs.default'); |
|
| 68 | - $this->assertEquals(Bootbox::class, get_class(dialog()->getConfirmLibrary())); |
|
| 69 | - $this->assertEquals(Bootbox::class, get_class(dialog()->getAlertLibrary())); |
|
| 70 | - $this->assertEquals(Bootbox::class, get_class(dialog()->getModalLibrary())); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - public function testDialogOptions() |
|
| 74 | - { |
|
| 75 | - jaxon()->app()->setup(__DIR__ . '/../config/dialog.php'); |
|
| 76 | - $this->assertStringContainsString('toast-top-center', jaxon()->script()); |
|
| 77 | - |
|
| 78 | - /** @var DialogPlugin */ |
|
| 79 | - $xDialogPlugin = jaxon()->di()->g(DialogPlugin::class); |
|
| 80 | - $this->assertStringContainsString('5.0.0', $xDialogPlugin->getHash()); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - public function testDialogDefaultMethods() |
|
| 84 | - { |
|
| 85 | - dialog()->registerLibrary(TestDialogLibrary::class, TestDialogLibrary::NAME); |
|
| 86 | - // Registering a library twice should not cause any issue. |
|
| 87 | - dialog()->registerLibrary(TestDialogLibrary::class, TestDialogLibrary::NAME); |
|
| 88 | - jaxon()->setAppOption('dialogs.default.confirm', TestDialogLibrary::NAME); |
|
| 89 | - $xConfirmLibrary = dialog()->getConfirmLibrary(); |
|
| 90 | - $this->assertEquals('', $xConfirmLibrary->getUri()); |
|
| 91 | - $this->assertEquals('', $xConfirmLibrary->getJs()); |
|
| 92 | - $this->assertEquals('', $xConfirmLibrary->getScript()); |
|
| 93 | - $this->assertEquals('', $xConfirmLibrary->getJsCode()->sJs); |
|
| 94 | - $this->assertEquals('', $xConfirmLibrary->getJsCode()->sJsBefore); |
|
| 95 | - $this->assertEquals('', $xConfirmLibrary->getJsCode()->sJsAfter); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - public function testExtDialogLibrary() |
|
| 99 | - { |
|
| 100 | - dialog()->registerLibrary(TestDialogLibrary::class, TestDialogLibrary::NAME); |
|
| 101 | - jaxon()->setAppOption('dialogs.default.confirm', TestDialogLibrary::NAME); |
|
| 102 | - $this->assertEquals(TestDialogLibrary::class, get_class(dialog()->getConfirmLibrary())); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - public function testExtDialogLibraryConfigSet() |
|
| 106 | - { |
|
| 107 | - jaxon()->setAppOption('dialogs.lib.ext', [ |
|
| 108 | - TestDialogLibrary::NAME => TestDialogLibrary::class, |
|
| 109 | - ]); |
|
| 110 | - jaxon()->setAppOption('dialogs.default.confirm', TestDialogLibrary::NAME); |
|
| 111 | - $this->assertEquals(TestDialogLibrary::class, get_class(dialog()->getConfirmLibrary())); |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - public function testExtDialogLibraryConfigFile() |
|
| 115 | - { |
|
| 116 | - jaxon()->app()->setup(__DIR__ . '/../config/ext.php'); |
|
| 117 | - $this->assertEquals(TestDialogLibrary::class, get_class(dialog()->getConfirmLibrary())); |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - public function testDialogJsCode() |
|
| 121 | - { |
|
| 122 | - jaxon()->setAppOption('dialogs.lib.use', ['bootbox', 'alertify', 'cute']); |
|
| 123 | - $sJsCode = jaxon()->js(); |
|
| 124 | - $this->assertStringContainsString('bootbox.min.js', $sJsCode); |
|
| 125 | - $this->assertStringContainsString('alertify.min.js', $sJsCode); |
|
| 126 | - $this->assertStringContainsString('cute-alert.js', $sJsCode); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - public function testDialogCssCode() |
|
| 130 | - { |
|
| 131 | - jaxon()->setAppOption('dialogs.lib.use', ['alertify', 'cute']); |
|
| 132 | - $sCssCode = jaxon()->css(); |
|
| 133 | - $this->assertStringContainsString('alertify.min.css', $sCssCode); |
|
| 134 | - $this->assertStringContainsString('cute-alert/style.css', $sCssCode); |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - /** |
|
| 41 | +public function tearDown(): void |
|
| 42 | +{ |
|
| 43 | +jaxon()->reset(); |
|
| 44 | +parent::tearDown(); |
|
| 45 | +} |
|
| 46 | + |
|
| 47 | +public function testDialogSettings() |
|
| 48 | +{ |
|
| 49 | +$this->assertEquals('', dialog()->getConfirmLibrary()->getName()); |
|
| 50 | +$this->assertEquals(Alert::class, get_class(dialog()->getConfirmLibrary())); |
|
| 51 | +$this->assertEquals(Alert::class, get_class(dialog()->getAlertLibrary())); |
|
| 52 | +$this->assertEquals(null, dialog()->getModalLibrary()); |
|
| 53 | + |
|
| 54 | +jaxon()->setAppOptions([ |
|
| 55 | +'modal' => 'alertify', |
|
| 56 | +'alert' => 'alertify', |
|
| 57 | +'confirm' => 'alertify', |
|
| 58 | +], 'dialogs.default'); |
|
| 59 | +$this->assertEquals(Alertify::class, get_class(dialog()->getConfirmLibrary())); |
|
| 60 | +$this->assertEquals(Alertify::class, get_class(dialog()->getAlertLibrary())); |
|
| 61 | +$this->assertEquals(Alertify::class, get_class(dialog()->getModalLibrary())); |
|
| 62 | + |
|
| 63 | +jaxon()->setAppOptions([ |
|
| 64 | +'modal' => 'bootbox', |
|
| 65 | +'alert' => 'bootbox', |
|
| 66 | +'confirm' => 'bootbox', |
|
| 67 | +], 'dialogs.default'); |
|
| 68 | +$this->assertEquals(Bootbox::class, get_class(dialog()->getConfirmLibrary())); |
|
| 69 | +$this->assertEquals(Bootbox::class, get_class(dialog()->getAlertLibrary())); |
|
| 70 | +$this->assertEquals(Bootbox::class, get_class(dialog()->getModalLibrary())); |
|
| 71 | +} |
|
| 72 | + |
|
| 73 | +public function testDialogOptions() |
|
| 74 | +{ |
|
| 75 | +jaxon()->app()->setup(__DIR__ . '/../config/dialog.php'); |
|
| 76 | +$this->assertStringContainsString('toast-top-center', jaxon()->script()); |
|
| 77 | + |
|
| 78 | +/** @var DialogPlugin */ |
|
| 79 | +$xDialogPlugin = jaxon()->di()->g(DialogPlugin::class); |
|
| 80 | +$this->assertStringContainsString('5.0.0', $xDialogPlugin->getHash()); |
|
| 81 | +} |
|
| 82 | + |
|
| 83 | +public function testDialogDefaultMethods() |
|
| 84 | +{ |
|
| 85 | +dialog()->registerLibrary(TestDialogLibrary::class, TestDialogLibrary::NAME); |
|
| 86 | +// Registering a library twice should not cause any issue. |
|
| 87 | +dialog()->registerLibrary(TestDialogLibrary::class, TestDialogLibrary::NAME); |
|
| 88 | +jaxon()->setAppOption('dialogs.default.confirm', TestDialogLibrary::NAME); |
|
| 89 | +$xConfirmLibrary = dialog()->getConfirmLibrary(); |
|
| 90 | +$this->assertEquals('', $xConfirmLibrary->getUri()); |
|
| 91 | +$this->assertEquals('', $xConfirmLibrary->getJs()); |
|
| 92 | +$this->assertEquals('', $xConfirmLibrary->getScript()); |
|
| 93 | +$this->assertEquals('', $xConfirmLibrary->getJsCode()->sJs); |
|
| 94 | +$this->assertEquals('', $xConfirmLibrary->getJsCode()->sJsBefore); |
|
| 95 | +$this->assertEquals('', $xConfirmLibrary->getJsCode()->sJsAfter); |
|
| 96 | +} |
|
| 97 | + |
|
| 98 | +public function testExtDialogLibrary() |
|
| 99 | +{ |
|
| 100 | +dialog()->registerLibrary(TestDialogLibrary::class, TestDialogLibrary::NAME); |
|
| 101 | +jaxon()->setAppOption('dialogs.default.confirm', TestDialogLibrary::NAME); |
|
| 102 | +$this->assertEquals(TestDialogLibrary::class, get_class(dialog()->getConfirmLibrary())); |
|
| 103 | +} |
|
| 104 | + |
|
| 105 | +public function testExtDialogLibraryConfigSet() |
|
| 106 | +{ |
|
| 107 | +jaxon()->setAppOption('dialogs.lib.ext', [ |
|
| 108 | +TestDialogLibrary::NAME => TestDialogLibrary::class, |
|
| 109 | +]); |
|
| 110 | +jaxon()->setAppOption('dialogs.default.confirm', TestDialogLibrary::NAME); |
|
| 111 | +$this->assertEquals(TestDialogLibrary::class, get_class(dialog()->getConfirmLibrary())); |
|
| 112 | +} |
|
| 113 | + |
|
| 114 | +public function testExtDialogLibraryConfigFile() |
|
| 115 | +{ |
|
| 116 | +jaxon()->app()->setup(__DIR__ . '/../config/ext.php'); |
|
| 117 | +$this->assertEquals(TestDialogLibrary::class, get_class(dialog()->getConfirmLibrary())); |
|
| 118 | +} |
|
| 119 | + |
|
| 120 | +public function testDialogJsCode() |
|
| 121 | +{ |
|
| 122 | +jaxon()->setAppOption('dialogs.lib.use', ['bootbox', 'alertify', 'cute']); |
|
| 123 | +$sJsCode = jaxon()->js(); |
|
| 124 | +$this->assertStringContainsString('bootbox.min.js', $sJsCode); |
|
| 125 | +$this->assertStringContainsString('alertify.min.js', $sJsCode); |
|
| 126 | +$this->assertStringContainsString('cute-alert.js', $sJsCode); |
|
| 127 | +} |
|
| 128 | + |
|
| 129 | +public function testDialogCssCode() |
|
| 130 | +{ |
|
| 131 | +jaxon()->setAppOption('dialogs.lib.use', ['alertify', 'cute']); |
|
| 132 | +$sCssCode = jaxon()->css(); |
|
| 133 | +$this->assertStringContainsString('alertify.min.css', $sCssCode); |
|
| 134 | +$this->assertStringContainsString('cute-alert/style.css', $sCssCode); |
|
| 135 | +} |
|
| 136 | + |
|
| 137 | +/** |
|
| 138 | 138 | * @throws UriException |
| 139 | 139 | */ |
| 140 | - public function testDialogScriptCode() |
|
| 141 | - { |
|
| 142 | - jaxon()->setAppOptions([ |
|
| 143 | - 'default' => [ |
|
| 144 | - 'modal' => 'alertify', |
|
| 145 | - 'alert' => 'alertify', |
|
| 146 | - 'confirm' => 'alertify', |
|
| 147 | - ], |
|
| 148 | - 'lib' => [ |
|
| 149 | - 'use' => ['bootbox', 'cute', 'jalert'], |
|
| 150 | - ], |
|
| 151 | - ], 'dialogs'); |
|
| 152 | - |
|
| 153 | - $sScriptCode = jaxon()->getScript(); |
|
| 154 | - $this->assertStringContainsString("jaxon.dialog.register('alertify'", $sScriptCode); |
|
| 155 | - $this->assertStringContainsString("jaxon.dialog.register('bootbox'", $sScriptCode); |
|
| 156 | - $this->assertStringContainsString("jaxon.dialog.register('cute'", $sScriptCode); |
|
| 157 | - $this->assertStringContainsString("jaxon.dialog.register('jalert'", $sScriptCode); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** |
|
| 140 | +public function testDialogScriptCode() |
|
| 141 | +{ |
|
| 142 | +jaxon()->setAppOptions([ |
|
| 143 | +'default' => [ |
|
| 144 | + 'modal' => 'alertify', |
|
| 145 | + 'alert' => 'alertify', |
|
| 146 | + 'confirm' => 'alertify', |
|
| 147 | +], |
|
| 148 | +'lib' => [ |
|
| 149 | + 'use' => ['bootbox', 'cute', 'jalert'], |
|
| 150 | +], |
|
| 151 | +], 'dialogs'); |
|
| 152 | + |
|
| 153 | +$sScriptCode = jaxon()->getScript(); |
|
| 154 | +$this->assertStringContainsString("jaxon.dialog.register('alertify'", $sScriptCode); |
|
| 155 | +$this->assertStringContainsString("jaxon.dialog.register('bootbox'", $sScriptCode); |
|
| 156 | +$this->assertStringContainsString("jaxon.dialog.register('cute'", $sScriptCode); |
|
| 157 | +$this->assertStringContainsString("jaxon.dialog.register('jalert'", $sScriptCode); |
|
| 158 | +} |
|
| 159 | + |
|
| 160 | +/** |
|
| 161 | 161 | * @throws UriException |
| 162 | 162 | */ |
| 163 | - public function testDialogScriptFile() |
|
| 164 | - { |
|
| 165 | - jaxon()->setOptions([ |
|
| 166 | - 'export' => true, |
|
| 167 | - 'minify' => false, |
|
| 168 | - 'file' => 'app', |
|
| 169 | - 'dir' => __DIR__ . '/../js', |
|
| 170 | - 'uri' => 'http://localhost', |
|
| 171 | - ], 'js.app'); |
|
| 172 | - jaxon()->setAppOptions([ |
|
| 173 | - 'default' => [ |
|
| 174 | - 'modal' => 'alertify', |
|
| 175 | - 'alert' => 'alertify', |
|
| 176 | - 'confirm' => 'alertify', |
|
| 177 | - ], |
|
| 178 | - 'lib' => [ |
|
| 179 | - 'use' => ['bootbox', 'cute', 'jalert'], |
|
| 180 | - ], |
|
| 181 | - ], 'dialogs'); |
|
| 182 | - |
|
| 183 | - $sScriptCode = jaxon()->getScript(); |
|
| 184 | - $this->assertStringNotContainsString("jaxon.dialog.register('alertify'", $sScriptCode); |
|
| 185 | - $this->assertStringNotContainsString("jaxon.dialog.register('bootbox'", $sScriptCode); |
|
| 186 | - $this->assertStringNotContainsString("jaxon.dialog.register('cute'", $sScriptCode); |
|
| 187 | - $this->assertStringNotContainsString("jaxon.dialog.register('jalert'", $sScriptCode); |
|
| 188 | - |
|
| 189 | - $this->assertStringContainsString('/js/alertify.js', $sScriptCode); |
|
| 190 | - $this->assertStringContainsString('/js/bootbox.js', $sScriptCode); |
|
| 191 | - $this->assertStringContainsString('/js/cute.js', $sScriptCode); |
|
| 192 | - $this->assertStringContainsString('/js/jalert.js', $sScriptCode); |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - /** |
|
| 163 | +public function testDialogScriptFile() |
|
| 164 | +{ |
|
| 165 | +jaxon()->setOptions([ |
|
| 166 | +'export' => true, |
|
| 167 | +'minify' => false, |
|
| 168 | +'file' => 'app', |
|
| 169 | +'dir' => __DIR__ . '/../js', |
|
| 170 | +'uri' => 'http://localhost', |
|
| 171 | +], 'js.app'); |
|
| 172 | +jaxon()->setAppOptions([ |
|
| 173 | +'default' => [ |
|
| 174 | + 'modal' => 'alertify', |
|
| 175 | + 'alert' => 'alertify', |
|
| 176 | + 'confirm' => 'alertify', |
|
| 177 | +], |
|
| 178 | +'lib' => [ |
|
| 179 | + 'use' => ['bootbox', 'cute', 'jalert'], |
|
| 180 | +], |
|
| 181 | +], 'dialogs'); |
|
| 182 | + |
|
| 183 | +$sScriptCode = jaxon()->getScript(); |
|
| 184 | +$this->assertStringNotContainsString("jaxon.dialog.register('alertify'", $sScriptCode); |
|
| 185 | +$this->assertStringNotContainsString("jaxon.dialog.register('bootbox'", $sScriptCode); |
|
| 186 | +$this->assertStringNotContainsString("jaxon.dialog.register('cute'", $sScriptCode); |
|
| 187 | +$this->assertStringNotContainsString("jaxon.dialog.register('jalert'", $sScriptCode); |
|
| 188 | + |
|
| 189 | +$this->assertStringContainsString('/js/alertify.js', $sScriptCode); |
|
| 190 | +$this->assertStringContainsString('/js/bootbox.js', $sScriptCode); |
|
| 191 | +$this->assertStringContainsString('/js/cute.js', $sScriptCode); |
|
| 192 | +$this->assertStringContainsString('/js/jalert.js', $sScriptCode); |
|
| 193 | +} |
|
| 194 | + |
|
| 195 | +/** |
|
| 196 | 196 | * @throws UriException |
| 197 | 197 | */ |
| 198 | - public function testDialogScriptMinFile() |
|
| 199 | - { |
|
| 200 | - jaxon()->setOptions([ |
|
| 201 | - 'export' => true, |
|
| 202 | - 'minify' => true, |
|
| 203 | - 'file' => 'app', |
|
| 204 | - 'dir' => __DIR__ . '/../js', |
|
| 205 | - 'uri' => 'http://localhost', |
|
| 206 | - ], 'js.app'); |
|
| 207 | - jaxon()->setAppOptions([ |
|
| 208 | - 'default' => [ |
|
| 209 | - 'modal' => 'alertify', |
|
| 210 | - 'alert' => 'alertify', |
|
| 211 | - 'confirm' => 'alertify', |
|
| 212 | - ], |
|
| 213 | - 'lib' => [ |
|
| 214 | - 'use' => ['bootbox', 'cute', 'jalert'], |
|
| 215 | - ], |
|
| 216 | - ], 'dialogs'); |
|
| 217 | - |
|
| 218 | - $sScriptCode = jaxon()->getScript(); |
|
| 219 | - $this->assertStringNotContainsString("jaxon.dialog.register('alertify'", $sScriptCode); |
|
| 220 | - $this->assertStringNotContainsString("jaxon.dialog.register('bootbox'", $sScriptCode); |
|
| 221 | - $this->assertStringNotContainsString("jaxon.dialog.register('cute'", $sScriptCode); |
|
| 222 | - $this->assertStringNotContainsString("jaxon.dialog.register('jalert'", $sScriptCode); |
|
| 223 | - |
|
| 224 | - $this->assertStringContainsString('/js/alertify.min.js', $sScriptCode); |
|
| 225 | - $this->assertStringContainsString('/js/bootbox.min.js', $sScriptCode); |
|
| 226 | - $this->assertStringContainsString('/js/cute.min.js', $sScriptCode); |
|
| 227 | - $this->assertStringContainsString('/js/jalert.min.js', $sScriptCode); |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - public function testAlertifyLibrary() |
|
| 231 | - { |
|
| 232 | - jaxon()->setAppOption('dialogs.lib.use', ['alertify']); |
|
| 233 | - |
|
| 234 | - $this->assertStringContainsString('alertify.min.js', jaxon()->js()); |
|
| 235 | - $this->assertStringContainsString('css/alertify.min.css', jaxon()->css()); |
|
| 236 | - $this->assertStringContainsString('css/themes/default.min.css', jaxon()->css()); |
|
| 237 | - $this->assertStringContainsString("jaxon.dialog.register('alertify'", jaxon()->script()); |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - public function testBootboxLibrary() |
|
| 241 | - { |
|
| 242 | - jaxon()->setAppOption('dialogs.lib.use', ['bootbox']); |
|
| 243 | - |
|
| 244 | - $this->assertStringContainsString('bootbox.min.js', jaxon()->js()); |
|
| 245 | - $this->assertStringContainsString("jaxon.dialog.register('bootbox'", jaxon()->script()); |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - public function testBootstrap3Library() |
|
| 249 | - { |
|
| 250 | - jaxon()->setAppOption('dialogs.lib.use', ['bootstrap3']); |
|
| 251 | - |
|
| 252 | - $this->assertStringContainsString("jaxon.dialog.register('bootstrap3'", jaxon()->script()); |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - public function testBootstrap4Library() |
|
| 256 | - { |
|
| 257 | - jaxon()->setAppOption('dialogs.lib.use', ['bootstrap4']); |
|
| 258 | - |
|
| 259 | - $this->assertStringContainsString("jaxon.dialog.register('bootstrap4'", jaxon()->script()); |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - public function testBootstrap5Library() |
|
| 263 | - { |
|
| 264 | - jaxon()->setAppOption('dialogs.lib.use', ['bootstrap5']); |
|
| 265 | - |
|
| 266 | - $this->assertStringContainsString("jaxon.dialog.register('bootstrap5'", jaxon()->script()); |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - public function testButterupLibrary() |
|
| 270 | - { |
|
| 271 | - jaxon()->setAppOption('dialogs.lib.use', ['butterup']); |
|
| 272 | - |
|
| 273 | - $this->assertStringContainsString('butterup.min.js', jaxon()->js()); |
|
| 274 | - $this->assertStringContainsString('butterup.min.css', jaxon()->css()); |
|
| 275 | - $this->assertStringContainsString("jaxon.dialog.register('butterup'", jaxon()->script()); |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - public function testCuteAlertLibrary() |
|
| 279 | - { |
|
| 280 | - jaxon()->setAppOption('dialogs.lib.use', ['cute']); |
|
| 281 | - |
|
| 282 | - $this->assertStringContainsString('cute-alert/cute-alert.js', jaxon()->js()); |
|
| 283 | - $this->assertStringContainsString('cute-alert/style.css', jaxon()->css()); |
|
| 284 | - $this->assertStringContainsString("jaxon.dialog.register('cute'", jaxon()->script()); |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - public function testIziToastLibrary() |
|
| 288 | - { |
|
| 289 | - jaxon()->setAppOption('dialogs.lib.use', ['izitoast']); |
|
| 290 | - |
|
| 291 | - $this->assertStringContainsString('js/iziToast.min.js', jaxon()->js()); |
|
| 292 | - $this->assertStringContainsString('css/iziToast.min.css', jaxon()->css()); |
|
| 293 | - $this->assertStringContainsString("jaxon.dialog.register('izitoast'", jaxon()->script()); |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - public function testJAlertLibrary() |
|
| 297 | - { |
|
| 298 | - jaxon()->setAppOption('dialogs.lib.use', ['jalert']); |
|
| 299 | - |
|
| 300 | - $this->assertStringContainsString('jAlert.min.js', jaxon()->js()); |
|
| 301 | - $this->assertStringContainsString('jAlert.min.css', jaxon()->css()); |
|
| 302 | - $this->assertStringContainsString("jaxon.dialog.register('jalert'", jaxon()->script()); |
|
| 303 | - } |
|
| 304 | - |
|
| 305 | - public function testJQueryConfirmLibrary() |
|
| 306 | - { |
|
| 307 | - jaxon()->setAppOption('dialogs.lib.use', ['jconfirm']); |
|
| 308 | - |
|
| 309 | - $this->assertStringContainsString('jquery-confirm.min.js', jaxon()->js()); |
|
| 310 | - $this->assertStringContainsString('jquery-confirm.min.css', jaxon()->css()); |
|
| 311 | - $this->assertStringContainsString("jaxon.dialog.register('jconfirm'", jaxon()->script()); |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - public function testNotifyLibrary() |
|
| 315 | - { |
|
| 316 | - jaxon()->setAppOption('dialogs.lib.use', ['notify']); |
|
| 317 | - |
|
| 318 | - $this->assertStringContainsString('notify.min.js', jaxon()->js()); |
|
| 319 | - $this->assertStringContainsString("jaxon.dialog.register('notify'", jaxon()->script()); |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - public function testNotyLibrary() |
|
| 323 | - { |
|
| 324 | - jaxon()->setAppOption('dialogs.lib.use', ['noty']); |
|
| 325 | - |
|
| 326 | - $this->assertStringContainsString('noty.min.js', jaxon()->js()); |
|
| 327 | - $this->assertStringContainsString('noty.min.css', jaxon()->css()); |
|
| 328 | - $this->assertStringContainsString("jaxon.dialog.register('noty'", jaxon()->script()); |
|
| 329 | - } |
|
| 330 | - |
|
| 331 | - public function testNotyfLibrary() |
|
| 332 | - { |
|
| 333 | - jaxon()->setAppOption('dialogs.lib.use', ['notyf']); |
|
| 334 | - |
|
| 335 | - $this->assertStringContainsString('notyf.min.js', jaxon()->js()); |
|
| 336 | - $this->assertStringContainsString('notyf.min.css', jaxon()->css()); |
|
| 337 | - $this->assertStringContainsString("jaxon.dialog.register('notyf'", jaxon()->script()); |
|
| 338 | - } |
|
| 339 | - |
|
| 340 | - public function testQuantumLibrary() |
|
| 341 | - { |
|
| 342 | - jaxon()->setAppOption('dialogs.lib.use', ['quantum']); |
|
| 343 | - |
|
| 344 | - $this->assertStringContainsString('minfile/quantumalert.js', jaxon()->js()); |
|
| 345 | - $this->assertStringContainsString("jaxon.dialog.register('quantum'", jaxon()->script()); |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - public function testSweetAlertLibrary() |
|
| 349 | - { |
|
| 350 | - jaxon()->setAppOption('dialogs.lib.use', ['sweetalert']); |
|
| 351 | - |
|
| 352 | - $this->assertStringContainsString('sweetalert.min.js', jaxon()->js()); |
|
| 353 | - $this->assertStringContainsString("jaxon.dialog.register('sweetalert'", jaxon()->script()); |
|
| 354 | - } |
|
| 355 | - |
|
| 356 | - public function testTingleLibrary() |
|
| 357 | - { |
|
| 358 | - jaxon()->setAppOption('dialogs.lib.use', ['tingle']); |
|
| 359 | - |
|
| 360 | - $this->assertStringContainsString('tingle.min.js', jaxon()->js()); |
|
| 361 | - $this->assertStringContainsString('tingle.min.css', jaxon()->css()); |
|
| 362 | - $this->assertStringContainsString("jaxon.dialog.register('tingle'", jaxon()->script()); |
|
| 363 | - } |
|
| 364 | - |
|
| 365 | - public function testToastrLibrary() |
|
| 366 | - { |
|
| 367 | - jaxon()->setAppOption('dialogs.lib.use', ['toastr']); |
|
| 368 | - |
|
| 369 | - $this->assertStringContainsString('toastr.min.js', jaxon()->js()); |
|
| 370 | - $this->assertStringContainsString('build/toastr.min.css', jaxon()->css()); |
|
| 371 | - $this->assertStringContainsString("jaxon.dialog.register('toastr'", jaxon()->script()); |
|
| 372 | - } |
|
| 373 | - |
|
| 374 | - /** |
|
| 198 | +public function testDialogScriptMinFile() |
|
| 199 | +{ |
|
| 200 | +jaxon()->setOptions([ |
|
| 201 | +'export' => true, |
|
| 202 | +'minify' => true, |
|
| 203 | +'file' => 'app', |
|
| 204 | +'dir' => __DIR__ . '/../js', |
|
| 205 | +'uri' => 'http://localhost', |
|
| 206 | +], 'js.app'); |
|
| 207 | +jaxon()->setAppOptions([ |
|
| 208 | +'default' => [ |
|
| 209 | + 'modal' => 'alertify', |
|
| 210 | + 'alert' => 'alertify', |
|
| 211 | + 'confirm' => 'alertify', |
|
| 212 | +], |
|
| 213 | +'lib' => [ |
|
| 214 | + 'use' => ['bootbox', 'cute', 'jalert'], |
|
| 215 | +], |
|
| 216 | +], 'dialogs'); |
|
| 217 | + |
|
| 218 | +$sScriptCode = jaxon()->getScript(); |
|
| 219 | +$this->assertStringNotContainsString("jaxon.dialog.register('alertify'", $sScriptCode); |
|
| 220 | +$this->assertStringNotContainsString("jaxon.dialog.register('bootbox'", $sScriptCode); |
|
| 221 | +$this->assertStringNotContainsString("jaxon.dialog.register('cute'", $sScriptCode); |
|
| 222 | +$this->assertStringNotContainsString("jaxon.dialog.register('jalert'", $sScriptCode); |
|
| 223 | + |
|
| 224 | +$this->assertStringContainsString('/js/alertify.min.js', $sScriptCode); |
|
| 225 | +$this->assertStringContainsString('/js/bootbox.min.js', $sScriptCode); |
|
| 226 | +$this->assertStringContainsString('/js/cute.min.js', $sScriptCode); |
|
| 227 | +$this->assertStringContainsString('/js/jalert.min.js', $sScriptCode); |
|
| 228 | +} |
|
| 229 | + |
|
| 230 | +public function testAlertifyLibrary() |
|
| 231 | +{ |
|
| 232 | +jaxon()->setAppOption('dialogs.lib.use', ['alertify']); |
|
| 233 | + |
|
| 234 | +$this->assertStringContainsString('alertify.min.js', jaxon()->js()); |
|
| 235 | +$this->assertStringContainsString('css/alertify.min.css', jaxon()->css()); |
|
| 236 | +$this->assertStringContainsString('css/themes/default.min.css', jaxon()->css()); |
|
| 237 | +$this->assertStringContainsString("jaxon.dialog.register('alertify'", jaxon()->script()); |
|
| 238 | +} |
|
| 239 | + |
|
| 240 | +public function testBootboxLibrary() |
|
| 241 | +{ |
|
| 242 | +jaxon()->setAppOption('dialogs.lib.use', ['bootbox']); |
|
| 243 | + |
|
| 244 | +$this->assertStringContainsString('bootbox.min.js', jaxon()->js()); |
|
| 245 | +$this->assertStringContainsString("jaxon.dialog.register('bootbox'", jaxon()->script()); |
|
| 246 | +} |
|
| 247 | + |
|
| 248 | +public function testBootstrap3Library() |
|
| 249 | +{ |
|
| 250 | +jaxon()->setAppOption('dialogs.lib.use', ['bootstrap3']); |
|
| 251 | + |
|
| 252 | +$this->assertStringContainsString("jaxon.dialog.register('bootstrap3'", jaxon()->script()); |
|
| 253 | +} |
|
| 254 | + |
|
| 255 | +public function testBootstrap4Library() |
|
| 256 | +{ |
|
| 257 | +jaxon()->setAppOption('dialogs.lib.use', ['bootstrap4']); |
|
| 258 | + |
|
| 259 | +$this->assertStringContainsString("jaxon.dialog.register('bootstrap4'", jaxon()->script()); |
|
| 260 | +} |
|
| 261 | + |
|
| 262 | +public function testBootstrap5Library() |
|
| 263 | +{ |
|
| 264 | +jaxon()->setAppOption('dialogs.lib.use', ['bootstrap5']); |
|
| 265 | + |
|
| 266 | +$this->assertStringContainsString("jaxon.dialog.register('bootstrap5'", jaxon()->script()); |
|
| 267 | +} |
|
| 268 | + |
|
| 269 | +public function testButterupLibrary() |
|
| 270 | +{ |
|
| 271 | +jaxon()->setAppOption('dialogs.lib.use', ['butterup']); |
|
| 272 | + |
|
| 273 | +$this->assertStringContainsString('butterup.min.js', jaxon()->js()); |
|
| 274 | +$this->assertStringContainsString('butterup.min.css', jaxon()->css()); |
|
| 275 | +$this->assertStringContainsString("jaxon.dialog.register('butterup'", jaxon()->script()); |
|
| 276 | +} |
|
| 277 | + |
|
| 278 | +public function testCuteAlertLibrary() |
|
| 279 | +{ |
|
| 280 | +jaxon()->setAppOption('dialogs.lib.use', ['cute']); |
|
| 281 | + |
|
| 282 | +$this->assertStringContainsString('cute-alert/cute-alert.js', jaxon()->js()); |
|
| 283 | +$this->assertStringContainsString('cute-alert/style.css', jaxon()->css()); |
|
| 284 | +$this->assertStringContainsString("jaxon.dialog.register('cute'", jaxon()->script()); |
|
| 285 | +} |
|
| 286 | + |
|
| 287 | +public function testIziToastLibrary() |
|
| 288 | +{ |
|
| 289 | +jaxon()->setAppOption('dialogs.lib.use', ['izitoast']); |
|
| 290 | + |
|
| 291 | +$this->assertStringContainsString('js/iziToast.min.js', jaxon()->js()); |
|
| 292 | +$this->assertStringContainsString('css/iziToast.min.css', jaxon()->css()); |
|
| 293 | +$this->assertStringContainsString("jaxon.dialog.register('izitoast'", jaxon()->script()); |
|
| 294 | +} |
|
| 295 | + |
|
| 296 | +public function testJAlertLibrary() |
|
| 297 | +{ |
|
| 298 | +jaxon()->setAppOption('dialogs.lib.use', ['jalert']); |
|
| 299 | + |
|
| 300 | +$this->assertStringContainsString('jAlert.min.js', jaxon()->js()); |
|
| 301 | +$this->assertStringContainsString('jAlert.min.css', jaxon()->css()); |
|
| 302 | +$this->assertStringContainsString("jaxon.dialog.register('jalert'", jaxon()->script()); |
|
| 303 | +} |
|
| 304 | + |
|
| 305 | +public function testJQueryConfirmLibrary() |
|
| 306 | +{ |
|
| 307 | +jaxon()->setAppOption('dialogs.lib.use', ['jconfirm']); |
|
| 308 | + |
|
| 309 | +$this->assertStringContainsString('jquery-confirm.min.js', jaxon()->js()); |
|
| 310 | +$this->assertStringContainsString('jquery-confirm.min.css', jaxon()->css()); |
|
| 311 | +$this->assertStringContainsString("jaxon.dialog.register('jconfirm'", jaxon()->script()); |
|
| 312 | +} |
|
| 313 | + |
|
| 314 | +public function testNotifyLibrary() |
|
| 315 | +{ |
|
| 316 | +jaxon()->setAppOption('dialogs.lib.use', ['notify']); |
|
| 317 | + |
|
| 318 | +$this->assertStringContainsString('notify.min.js', jaxon()->js()); |
|
| 319 | +$this->assertStringContainsString("jaxon.dialog.register('notify'", jaxon()->script()); |
|
| 320 | +} |
|
| 321 | + |
|
| 322 | +public function testNotyLibrary() |
|
| 323 | +{ |
|
| 324 | +jaxon()->setAppOption('dialogs.lib.use', ['noty']); |
|
| 325 | + |
|
| 326 | +$this->assertStringContainsString('noty.min.js', jaxon()->js()); |
|
| 327 | +$this->assertStringContainsString('noty.min.css', jaxon()->css()); |
|
| 328 | +$this->assertStringContainsString("jaxon.dialog.register('noty'", jaxon()->script()); |
|
| 329 | +} |
|
| 330 | + |
|
| 331 | +public function testNotyfLibrary() |
|
| 332 | +{ |
|
| 333 | +jaxon()->setAppOption('dialogs.lib.use', ['notyf']); |
|
| 334 | + |
|
| 335 | +$this->assertStringContainsString('notyf.min.js', jaxon()->js()); |
|
| 336 | +$this->assertStringContainsString('notyf.min.css', jaxon()->css()); |
|
| 337 | +$this->assertStringContainsString("jaxon.dialog.register('notyf'", jaxon()->script()); |
|
| 338 | +} |
|
| 339 | + |
|
| 340 | +public function testQuantumLibrary() |
|
| 341 | +{ |
|
| 342 | +jaxon()->setAppOption('dialogs.lib.use', ['quantum']); |
|
| 343 | + |
|
| 344 | +$this->assertStringContainsString('minfile/quantumalert.js', jaxon()->js()); |
|
| 345 | +$this->assertStringContainsString("jaxon.dialog.register('quantum'", jaxon()->script()); |
|
| 346 | +} |
|
| 347 | + |
|
| 348 | +public function testSweetAlertLibrary() |
|
| 349 | +{ |
|
| 350 | +jaxon()->setAppOption('dialogs.lib.use', ['sweetalert']); |
|
| 351 | + |
|
| 352 | +$this->assertStringContainsString('sweetalert.min.js', jaxon()->js()); |
|
| 353 | +$this->assertStringContainsString("jaxon.dialog.register('sweetalert'", jaxon()->script()); |
|
| 354 | +} |
|
| 355 | + |
|
| 356 | +public function testTingleLibrary() |
|
| 357 | +{ |
|
| 358 | +jaxon()->setAppOption('dialogs.lib.use', ['tingle']); |
|
| 359 | + |
|
| 360 | +$this->assertStringContainsString('tingle.min.js', jaxon()->js()); |
|
| 361 | +$this->assertStringContainsString('tingle.min.css', jaxon()->css()); |
|
| 362 | +$this->assertStringContainsString("jaxon.dialog.register('tingle'", jaxon()->script()); |
|
| 363 | +} |
|
| 364 | + |
|
| 365 | +public function testToastrLibrary() |
|
| 366 | +{ |
|
| 367 | +jaxon()->setAppOption('dialogs.lib.use', ['toastr']); |
|
| 368 | + |
|
| 369 | +$this->assertStringContainsString('toastr.min.js', jaxon()->js()); |
|
| 370 | +$this->assertStringContainsString('build/toastr.min.css', jaxon()->css()); |
|
| 371 | +$this->assertStringContainsString("jaxon.dialog.register('toastr'", jaxon()->script()); |
|
| 372 | +} |
|
| 373 | + |
|
| 374 | +/** |
|
| 375 | 375 | * @throws SetupException |
| 376 | 376 | */ |
| 377 | - public function testErrorRegisterIncorrectDialogClass() |
|
| 378 | - { |
|
| 379 | - $this->expectException(SetupException::class); |
|
| 380 | - dialog()->registerLibrary(Dialog::class, 'incorrect'); |
|
| 381 | - } |
|
| 382 | - |
|
| 383 | - public function testErrorRegisterIncorrectDialogClassWithInterface() |
|
| 384 | - { |
|
| 385 | - $this->expectException(SetupException::class); |
|
| 386 | - dialog()->registerLibrary(ClassWithInterface::class, 'incorrect'); |
|
| 387 | - } |
|
| 388 | - |
|
| 389 | - public function testErrorSetWrongAlertLibrary() |
|
| 390 | - { |
|
| 391 | - $this->expectException(SetupException::class); |
|
| 392 | - jaxon()->setAppOption('dialogs.default.alert', 'incorrect'); |
|
| 393 | - } |
|
| 394 | - |
|
| 395 | - public function testErrorSetWrongModalLibrary() |
|
| 396 | - { |
|
| 397 | - $this->expectException(SetupException::class); |
|
| 398 | - jaxon()->setAppOption('dialogs.default.modal', 'incorrect'); |
|
| 399 | - } |
|
| 400 | - |
|
| 401 | - public function testErrorSetWrongConfirmLibrary() |
|
| 402 | - { |
|
| 403 | - $this->expectException(SetupException::class); |
|
| 404 | - jaxon()->setAppOption('dialogs.default.confirm', 'incorrect'); |
|
| 405 | - } |
|
| 377 | +public function testErrorRegisterIncorrectDialogClass() |
|
| 378 | +{ |
|
| 379 | +$this->expectException(SetupException::class); |
|
| 380 | +dialog()->registerLibrary(Dialog::class, 'incorrect'); |
|
| 381 | +} |
|
| 382 | + |
|
| 383 | +public function testErrorRegisterIncorrectDialogClassWithInterface() |
|
| 384 | +{ |
|
| 385 | +$this->expectException(SetupException::class); |
|
| 386 | +dialog()->registerLibrary(ClassWithInterface::class, 'incorrect'); |
|
| 387 | +} |
|
| 388 | + |
|
| 389 | +public function testErrorSetWrongAlertLibrary() |
|
| 390 | +{ |
|
| 391 | +$this->expectException(SetupException::class); |
|
| 392 | +jaxon()->setAppOption('dialogs.default.alert', 'incorrect'); |
|
| 393 | +} |
|
| 394 | + |
|
| 395 | +public function testErrorSetWrongModalLibrary() |
|
| 396 | +{ |
|
| 397 | +$this->expectException(SetupException::class); |
|
| 398 | +jaxon()->setAppOption('dialogs.default.modal', 'incorrect'); |
|
| 399 | +} |
|
| 400 | + |
|
| 401 | +public function testErrorSetWrongConfirmLibrary() |
|
| 402 | +{ |
|
| 403 | +$this->expectException(SetupException::class); |
|
| 404 | +jaxon()->setAppOption('dialogs.default.confirm', 'incorrect'); |
|
| 405 | +} |
|
| 406 | 406 | } |