@@ -21,472 +21,472 @@ |
||
| 21 | 21 | |
| 22 | 22 | class CallTest extends TestCase |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * @throws SetupException |
| 26 | 26 | */ |
| 27 | - public function setUp(): void |
|
| 28 | - { |
|
| 29 | - _register(); |
|
| 30 | - jaxon()->setOption('core.prefix.class', ''); |
|
| 31 | - jaxon()->setOption('core.request.uri', 'http://example.test/path'); |
|
| 32 | - jaxon()->register(Jaxon::CALLABLE_CLASS, Dialog::class); |
|
| 33 | - dialog()->registerLibrary(TestDialogLibrary::class, TestDialogLibrary::NAME); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** |
|
| 27 | +public function setUp(): void |
|
| 28 | +{ |
|
| 29 | +_register(); |
|
| 30 | +jaxon()->setOption('core.prefix.class', ''); |
|
| 31 | +jaxon()->setOption('core.request.uri', 'http://example.test/path'); |
|
| 32 | +jaxon()->register(Jaxon::CALLABLE_CLASS, Dialog::class); |
|
| 33 | +dialog()->registerLibrary(TestDialogLibrary::class, TestDialogLibrary::NAME); |
|
| 34 | +} |
|
| 35 | + |
|
| 36 | +/** |
|
| 37 | 37 | * @throws SetupException |
| 38 | 38 | */ |
| 39 | - public function tearDown(): void |
|
| 40 | - { |
|
| 41 | - jaxon()->reset(); |
|
| 42 | - parent::tearDown(); |
|
| 43 | - } |
|
| 39 | +public function tearDown(): void |
|
| 40 | +{ |
|
| 41 | +jaxon()->reset(); |
|
| 42 | +parent::tearDown(); |
|
| 43 | +} |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | +/** |
|
| 46 | 46 | * @throws RequestException |
| 47 | 47 | */ |
| 48 | - public function testDefaultDialogSuccess() |
|
| 49 | - { |
|
| 50 | - // The server request |
|
| 51 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 52 | - return $c->g(ServerRequestCreator::class) |
|
| 53 | - ->fromGlobals() |
|
| 54 | - ->withQueryParams([ |
|
| 55 | - 'jxncall' => json_encode([ |
|
| 56 | - 'type' => 'class', |
|
| 57 | - 'name' => 'Dialog', |
|
| 58 | - 'method' => 'success', |
|
| 59 | - 'args' => [], |
|
| 60 | - ]), |
|
| 61 | - ]); |
|
| 62 | - }); |
|
| 63 | - |
|
| 64 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 65 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 66 | - |
|
| 67 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 68 | - $this->assertCount(1, $aCommands); |
|
| 69 | - $this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - /** |
|
| 48 | +public function testDefaultDialogSuccess() |
|
| 49 | +{ |
|
| 50 | +// The server request |
|
| 51 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 52 | +return $c->g(ServerRequestCreator::class) |
|
| 53 | + ->fromGlobals() |
|
| 54 | + ->withQueryParams([ |
|
| 55 | + 'jxncall' => json_encode([ |
|
| 56 | + 'type' => 'class', |
|
| 57 | + 'name' => 'Dialog', |
|
| 58 | + 'method' => 'success', |
|
| 59 | + 'args' => [], |
|
| 60 | + ]), |
|
| 61 | + ]); |
|
| 62 | +}); |
|
| 63 | + |
|
| 64 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 65 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 66 | + |
|
| 67 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 68 | +$this->assertCount(1, $aCommands); |
|
| 69 | +$this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 70 | +} |
|
| 71 | + |
|
| 72 | +/** |
|
| 73 | 73 | * @throws RequestException |
| 74 | 74 | */ |
| 75 | - public function testDialogLibrarySuccess() |
|
| 76 | - { |
|
| 77 | - jaxon()->setAppOptions([ |
|
| 78 | - 'modal' => 'alertify', |
|
| 79 | - 'alert' => 'alertify', |
|
| 80 | - 'confirm' => 'alertify', |
|
| 81 | - ], 'dialogs.default'); |
|
| 82 | - // The server request |
|
| 83 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 84 | - return $c->g(ServerRequestCreator::class) |
|
| 85 | - ->fromGlobals() |
|
| 86 | - ->withQueryParams([ |
|
| 87 | - 'jxncall' => json_encode([ |
|
| 88 | - 'type' => 'class', |
|
| 89 | - 'name' => 'Dialog', |
|
| 90 | - 'method' => 'success', |
|
| 91 | - 'args' => [], |
|
| 92 | - ]), |
|
| 93 | - ]); |
|
| 94 | - }); |
|
| 95 | - |
|
| 96 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 97 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 98 | - |
|
| 99 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 100 | - $this->assertCount(1, $aCommands); |
|
| 101 | - $this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 102 | - $this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - /** |
|
| 75 | +public function testDialogLibrarySuccess() |
|
| 76 | +{ |
|
| 77 | +jaxon()->setAppOptions([ |
|
| 78 | +'modal' => 'alertify', |
|
| 79 | +'alert' => 'alertify', |
|
| 80 | +'confirm' => 'alertify', |
|
| 81 | +], 'dialogs.default'); |
|
| 82 | +// The server request |
|
| 83 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 84 | +return $c->g(ServerRequestCreator::class) |
|
| 85 | + ->fromGlobals() |
|
| 86 | + ->withQueryParams([ |
|
| 87 | + 'jxncall' => json_encode([ |
|
| 88 | + 'type' => 'class', |
|
| 89 | + 'name' => 'Dialog', |
|
| 90 | + 'method' => 'success', |
|
| 91 | + 'args' => [], |
|
| 92 | + ]), |
|
| 93 | + ]); |
|
| 94 | +}); |
|
| 95 | + |
|
| 96 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 97 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 98 | + |
|
| 99 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 100 | +$this->assertCount(1, $aCommands); |
|
| 101 | +$this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 102 | +$this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 103 | +} |
|
| 104 | + |
|
| 105 | +/** |
|
| 106 | 106 | * @throws RequestException |
| 107 | 107 | */ |
| 108 | - public function testDefaultDialogWarning() |
|
| 109 | - { |
|
| 110 | - // The server request |
|
| 111 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 112 | - return $c->g(ServerRequestCreator::class) |
|
| 113 | - ->fromGlobals() |
|
| 114 | - ->withQueryParams([ |
|
| 115 | - 'jxncall' => json_encode([ |
|
| 116 | - 'type' => 'class', |
|
| 117 | - 'name' => 'Dialog', |
|
| 118 | - 'method' => 'warning', |
|
| 119 | - 'args' => [], |
|
| 120 | - ]), |
|
| 121 | - ]); |
|
| 122 | - }); |
|
| 123 | - |
|
| 124 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 125 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 126 | - |
|
| 127 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 128 | - $this->assertCount(1, $aCommands); |
|
| 129 | - $this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - /** |
|
| 108 | +public function testDefaultDialogWarning() |
|
| 109 | +{ |
|
| 110 | +// The server request |
|
| 111 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 112 | +return $c->g(ServerRequestCreator::class) |
|
| 113 | + ->fromGlobals() |
|
| 114 | + ->withQueryParams([ |
|
| 115 | + 'jxncall' => json_encode([ |
|
| 116 | + 'type' => 'class', |
|
| 117 | + 'name' => 'Dialog', |
|
| 118 | + 'method' => 'warning', |
|
| 119 | + 'args' => [], |
|
| 120 | + ]), |
|
| 121 | + ]); |
|
| 122 | +}); |
|
| 123 | + |
|
| 124 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 125 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 126 | + |
|
| 127 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 128 | +$this->assertCount(1, $aCommands); |
|
| 129 | +$this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 130 | +} |
|
| 131 | + |
|
| 132 | +/** |
|
| 133 | 133 | * @throws RequestException |
| 134 | 134 | */ |
| 135 | - public function testDialogLibraryWarning() |
|
| 136 | - { |
|
| 137 | - jaxon()->setAppOptions([ |
|
| 138 | - 'modal' => 'alertify', |
|
| 139 | - 'alert' => 'alertify', |
|
| 140 | - 'confirm' => 'alertify', |
|
| 141 | - ], 'dialogs.default'); |
|
| 142 | - // The server request |
|
| 143 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 144 | - return $c->g(ServerRequestCreator::class) |
|
| 145 | - ->fromGlobals() |
|
| 146 | - ->withQueryParams([ |
|
| 147 | - 'jxncall' => json_encode([ |
|
| 148 | - 'type' => 'class', |
|
| 149 | - 'name' => 'Dialog', |
|
| 150 | - 'method' => 'warning', |
|
| 151 | - 'args' => [], |
|
| 152 | - ]), |
|
| 153 | - ]); |
|
| 154 | - }); |
|
| 155 | - |
|
| 156 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 157 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 158 | - |
|
| 159 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 160 | - $this->assertCount(1, $aCommands); |
|
| 161 | - $this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 162 | - $this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - /** |
|
| 135 | +public function testDialogLibraryWarning() |
|
| 136 | +{ |
|
| 137 | +jaxon()->setAppOptions([ |
|
| 138 | +'modal' => 'alertify', |
|
| 139 | +'alert' => 'alertify', |
|
| 140 | +'confirm' => 'alertify', |
|
| 141 | +], 'dialogs.default'); |
|
| 142 | +// The server request |
|
| 143 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 144 | +return $c->g(ServerRequestCreator::class) |
|
| 145 | + ->fromGlobals() |
|
| 146 | + ->withQueryParams([ |
|
| 147 | + 'jxncall' => json_encode([ |
|
| 148 | + 'type' => 'class', |
|
| 149 | + 'name' => 'Dialog', |
|
| 150 | + 'method' => 'warning', |
|
| 151 | + 'args' => [], |
|
| 152 | + ]), |
|
| 153 | + ]); |
|
| 154 | +}); |
|
| 155 | + |
|
| 156 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 157 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 158 | + |
|
| 159 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 160 | +$this->assertCount(1, $aCommands); |
|
| 161 | +$this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 162 | +$this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 163 | +} |
|
| 164 | + |
|
| 165 | +/** |
|
| 166 | 166 | * @throws RequestException |
| 167 | 167 | */ |
| 168 | - public function testDefaultDialogInfo() |
|
| 169 | - { |
|
| 170 | - // The server request |
|
| 171 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 172 | - return $c->g(ServerRequestCreator::class) |
|
| 173 | - ->fromGlobals() |
|
| 174 | - ->withQueryParams([ |
|
| 175 | - 'jxncall' => json_encode([ |
|
| 176 | - 'type' => 'class', |
|
| 177 | - 'name' => 'Dialog', |
|
| 178 | - 'method' => 'info', |
|
| 179 | - 'args' => [], |
|
| 180 | - ]), |
|
| 181 | - ]); |
|
| 182 | - }); |
|
| 183 | - |
|
| 184 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 185 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 186 | - |
|
| 187 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 188 | - $this->assertCount(1, $aCommands); |
|
| 189 | - $this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - /** |
|
| 168 | +public function testDefaultDialogInfo() |
|
| 169 | +{ |
|
| 170 | +// The server request |
|
| 171 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 172 | +return $c->g(ServerRequestCreator::class) |
|
| 173 | + ->fromGlobals() |
|
| 174 | + ->withQueryParams([ |
|
| 175 | + 'jxncall' => json_encode([ |
|
| 176 | + 'type' => 'class', |
|
| 177 | + 'name' => 'Dialog', |
|
| 178 | + 'method' => 'info', |
|
| 179 | + 'args' => [], |
|
| 180 | + ]), |
|
| 181 | + ]); |
|
| 182 | +}); |
|
| 183 | + |
|
| 184 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 185 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 186 | + |
|
| 187 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 188 | +$this->assertCount(1, $aCommands); |
|
| 189 | +$this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 190 | +} |
|
| 191 | + |
|
| 192 | +/** |
|
| 193 | 193 | * @throws RequestException |
| 194 | 194 | */ |
| 195 | - public function testDialogLibraryInfo() |
|
| 196 | - { |
|
| 197 | - jaxon()->setAppOptions([ |
|
| 198 | - 'modal' => 'alertify', |
|
| 199 | - 'alert' => 'alertify', |
|
| 200 | - 'confirm' => 'alertify', |
|
| 201 | - ], 'dialogs.default'); |
|
| 202 | - // The server request |
|
| 203 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 204 | - return $c->g(ServerRequestCreator::class) |
|
| 205 | - ->fromGlobals() |
|
| 206 | - ->withQueryParams([ |
|
| 207 | - 'jxncall' => json_encode([ |
|
| 208 | - 'type' => 'class', |
|
| 209 | - 'name' => 'Dialog', |
|
| 210 | - 'method' => 'info', |
|
| 211 | - 'args' => [], |
|
| 212 | - ]), |
|
| 213 | - ]); |
|
| 214 | - }); |
|
| 215 | - |
|
| 216 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 217 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 218 | - |
|
| 219 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 220 | - $this->assertCount(1, $aCommands); |
|
| 221 | - $this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 222 | - $this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - /** |
|
| 195 | +public function testDialogLibraryInfo() |
|
| 196 | +{ |
|
| 197 | +jaxon()->setAppOptions([ |
|
| 198 | +'modal' => 'alertify', |
|
| 199 | +'alert' => 'alertify', |
|
| 200 | +'confirm' => 'alertify', |
|
| 201 | +], 'dialogs.default'); |
|
| 202 | +// The server request |
|
| 203 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 204 | +return $c->g(ServerRequestCreator::class) |
|
| 205 | + ->fromGlobals() |
|
| 206 | + ->withQueryParams([ |
|
| 207 | + 'jxncall' => json_encode([ |
|
| 208 | + 'type' => 'class', |
|
| 209 | + 'name' => 'Dialog', |
|
| 210 | + 'method' => 'info', |
|
| 211 | + 'args' => [], |
|
| 212 | + ]), |
|
| 213 | + ]); |
|
| 214 | +}); |
|
| 215 | + |
|
| 216 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 217 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 218 | + |
|
| 219 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 220 | +$this->assertCount(1, $aCommands); |
|
| 221 | +$this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 222 | +$this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 223 | +} |
|
| 224 | + |
|
| 225 | +/** |
|
| 226 | 226 | * @throws RequestException |
| 227 | 227 | */ |
| 228 | - public function testDefaultDialogError() |
|
| 229 | - { |
|
| 230 | - // The server request |
|
| 231 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 232 | - return $c->g(ServerRequestCreator::class) |
|
| 233 | - ->fromGlobals() |
|
| 234 | - ->withQueryParams([ |
|
| 235 | - 'jxncall' => json_encode([ |
|
| 236 | - 'type' => 'class', |
|
| 237 | - 'name' => 'Dialog', |
|
| 238 | - 'method' => 'error', |
|
| 239 | - 'args' => [], |
|
| 240 | - ]), |
|
| 241 | - ]); |
|
| 242 | - }); |
|
| 243 | - |
|
| 244 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 245 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 246 | - |
|
| 247 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 248 | - $this->assertCount(1, $aCommands); |
|
| 249 | - $this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - /** |
|
| 228 | +public function testDefaultDialogError() |
|
| 229 | +{ |
|
| 230 | +// The server request |
|
| 231 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 232 | +return $c->g(ServerRequestCreator::class) |
|
| 233 | + ->fromGlobals() |
|
| 234 | + ->withQueryParams([ |
|
| 235 | + 'jxncall' => json_encode([ |
|
| 236 | + 'type' => 'class', |
|
| 237 | + 'name' => 'Dialog', |
|
| 238 | + 'method' => 'error', |
|
| 239 | + 'args' => [], |
|
| 240 | + ]), |
|
| 241 | + ]); |
|
| 242 | +}); |
|
| 243 | + |
|
| 244 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 245 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 246 | + |
|
| 247 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 248 | +$this->assertCount(1, $aCommands); |
|
| 249 | +$this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 250 | +} |
|
| 251 | + |
|
| 252 | +/** |
|
| 253 | 253 | * @throws RequestException |
| 254 | 254 | */ |
| 255 | - public function testDialogLibraryError() |
|
| 256 | - { |
|
| 257 | - jaxon()->setAppOptions([ |
|
| 258 | - 'modal' => 'alertify', |
|
| 259 | - 'alert' => 'alertify', |
|
| 260 | - 'confirm' => 'alertify', |
|
| 261 | - ], 'dialogs.default'); |
|
| 262 | - // The server request |
|
| 263 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 264 | - return $c->g(ServerRequestCreator::class) |
|
| 265 | - ->fromGlobals() |
|
| 266 | - ->withQueryParams([ |
|
| 267 | - 'jxncall' => json_encode([ |
|
| 268 | - 'type' => 'class', |
|
| 269 | - 'name' => 'Dialog', |
|
| 270 | - 'method' => 'error', |
|
| 271 | - 'args' => [], |
|
| 272 | - ]), |
|
| 273 | - ]); |
|
| 274 | - }); |
|
| 275 | - |
|
| 276 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 277 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 278 | - |
|
| 279 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 280 | - $this->assertCount(1, $aCommands); |
|
| 281 | - $this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 282 | - $this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - /** |
|
| 255 | +public function testDialogLibraryError() |
|
| 256 | +{ |
|
| 257 | +jaxon()->setAppOptions([ |
|
| 258 | +'modal' => 'alertify', |
|
| 259 | +'alert' => 'alertify', |
|
| 260 | +'confirm' => 'alertify', |
|
| 261 | +], 'dialogs.default'); |
|
| 262 | +// The server request |
|
| 263 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 264 | +return $c->g(ServerRequestCreator::class) |
|
| 265 | +->fromGlobals() |
|
| 266 | +->withQueryParams([ |
|
| 267 | + 'jxncall' => json_encode([ |
|
| 268 | + 'type' => 'class', |
|
| 269 | + 'name' => 'Dialog', |
|
| 270 | + 'method' => 'error', |
|
| 271 | + 'args' => [], |
|
| 272 | + ]), |
|
| 273 | +]); |
|
| 274 | +}); |
|
| 275 | + |
|
| 276 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 277 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 278 | + |
|
| 279 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 280 | +$this->assertCount(1, $aCommands); |
|
| 281 | +$this->assertEquals('dialog.alert.show', $aCommands[0]['name']); |
|
| 282 | +$this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 283 | +} |
|
| 284 | + |
|
| 285 | +/** |
|
| 286 | 286 | * @throws RequestException |
| 287 | 287 | */ |
| 288 | - public function testDialogLibraryShow() |
|
| 289 | - { |
|
| 290 | - jaxon()->setAppOptions([ |
|
| 291 | - 'modal' => 'alertify', |
|
| 292 | - 'alert' => 'alertify', |
|
| 293 | - 'confirm' => 'alertify', |
|
| 294 | - ], 'dialogs.default'); |
|
| 295 | - // The server request |
|
| 296 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 297 | - return $c->g(ServerRequestCreator::class) |
|
| 298 | - ->fromGlobals() |
|
| 299 | - ->withQueryParams([ |
|
| 300 | - 'jxncall' => json_encode([ |
|
| 301 | - 'type' => 'class', |
|
| 302 | - 'name' => 'Dialog', |
|
| 303 | - 'method' => 'show', |
|
| 304 | - 'args' => [], |
|
| 305 | - ]), |
|
| 306 | - ]); |
|
| 307 | - }); |
|
| 308 | - |
|
| 309 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 310 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 311 | - |
|
| 312 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 313 | - $this->assertCount(1, $aCommands); |
|
| 314 | - $this->assertEquals('dialog.modal.show', $aCommands[0]['name']); |
|
| 315 | - $this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - /** |
|
| 288 | +public function testDialogLibraryShow() |
|
| 289 | +{ |
|
| 290 | +jaxon()->setAppOptions([ |
|
| 291 | +'modal' => 'alertify', |
|
| 292 | +'alert' => 'alertify', |
|
| 293 | +'confirm' => 'alertify', |
|
| 294 | +], 'dialogs.default'); |
|
| 295 | +// The server request |
|
| 296 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 297 | +return $c->g(ServerRequestCreator::class) |
|
| 298 | + ->fromGlobals() |
|
| 299 | + ->withQueryParams([ |
|
| 300 | + 'jxncall' => json_encode([ |
|
| 301 | + 'type' => 'class', |
|
| 302 | + 'name' => 'Dialog', |
|
| 303 | + 'method' => 'show', |
|
| 304 | + 'args' => [], |
|
| 305 | + ]), |
|
| 306 | + ]); |
|
| 307 | +}); |
|
| 308 | + |
|
| 309 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 310 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 311 | + |
|
| 312 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 313 | +$this->assertCount(1, $aCommands); |
|
| 314 | +$this->assertEquals('dialog.modal.show', $aCommands[0]['name']); |
|
| 315 | +$this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 316 | +} |
|
| 317 | + |
|
| 318 | +/** |
|
| 319 | 319 | * @throws RequestException |
| 320 | 320 | */ |
| 321 | - public function testBootboxLibraryShow() |
|
| 322 | - { |
|
| 323 | - jaxon()->setAppOptions([ |
|
| 324 | - 'modal' => 'alertify', |
|
| 325 | - 'alert' => 'alertify', |
|
| 326 | - 'confirm' => 'alertify', |
|
| 327 | - ], 'dialogs.default'); |
|
| 328 | - // The server request |
|
| 329 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 330 | - return $c->g(ServerRequestCreator::class) |
|
| 331 | - ->fromGlobals() |
|
| 332 | - ->withQueryParams([ |
|
| 333 | - 'jxncall' => json_encode([ |
|
| 334 | - 'type' => 'class', |
|
| 335 | - 'name' => 'Dialog', |
|
| 336 | - 'method' => 'show', |
|
| 337 | - 'args' => [], |
|
| 338 | - ]), |
|
| 339 | - ]); |
|
| 340 | - }); |
|
| 341 | - |
|
| 342 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 343 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 344 | - |
|
| 345 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 346 | - $this->assertCount(1, $aCommands); |
|
| 347 | - $this->assertEquals('dialog.modal.show', $aCommands[0]['name']); |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - /** |
|
| 321 | +public function testBootboxLibraryShow() |
|
| 322 | +{ |
|
| 323 | +jaxon()->setAppOptions([ |
|
| 324 | +'modal' => 'alertify', |
|
| 325 | +'alert' => 'alertify', |
|
| 326 | +'confirm' => 'alertify', |
|
| 327 | +], 'dialogs.default'); |
|
| 328 | +// The server request |
|
| 329 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 330 | +return $c->g(ServerRequestCreator::class) |
|
| 331 | + ->fromGlobals() |
|
| 332 | + ->withQueryParams([ |
|
| 333 | + 'jxncall' => json_encode([ |
|
| 334 | + 'type' => 'class', |
|
| 335 | + 'name' => 'Dialog', |
|
| 336 | + 'method' => 'show', |
|
| 337 | + 'args' => [], |
|
| 338 | + ]), |
|
| 339 | + ]); |
|
| 340 | +}); |
|
| 341 | + |
|
| 342 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 343 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 344 | + |
|
| 345 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 346 | +$this->assertCount(1, $aCommands); |
|
| 347 | +$this->assertEquals('dialog.modal.show', $aCommands[0]['name']); |
|
| 348 | +} |
|
| 349 | + |
|
| 350 | +/** |
|
| 351 | 351 | * @throws RequestException |
| 352 | 352 | */ |
| 353 | - public function testDialogLibraryShowWith() |
|
| 354 | - { |
|
| 355 | - jaxon()->setAppOptions([ |
|
| 356 | - 'modal' => 'alertify', |
|
| 357 | - 'alert' => 'alertify', |
|
| 358 | - 'confirm' => 'alertify', |
|
| 359 | - ], 'dialogs.default'); |
|
| 360 | - // The server request |
|
| 361 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 362 | - return $c->g(ServerRequestCreator::class) |
|
| 363 | - ->fromGlobals() |
|
| 364 | - ->withQueryParams([ |
|
| 365 | - 'jxncall' => json_encode([ |
|
| 366 | - 'type' => 'class', |
|
| 367 | - 'name' => 'Dialog', |
|
| 368 | - 'method' => 'showWith', |
|
| 369 | - 'args' => [], |
|
| 370 | - ]), |
|
| 371 | - ]); |
|
| 372 | - }); |
|
| 373 | - |
|
| 374 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 375 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 376 | - |
|
| 377 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 378 | - $this->assertCount(1, $aCommands); |
|
| 379 | - $this->assertEquals('dialog.modal.show', $aCommands[0]['name']); |
|
| 380 | - } |
|
| 381 | - |
|
| 382 | - /** |
|
| 353 | +public function testDialogLibraryShowWith() |
|
| 354 | +{ |
|
| 355 | +jaxon()->setAppOptions([ |
|
| 356 | +'modal' => 'alertify', |
|
| 357 | +'alert' => 'alertify', |
|
| 358 | +'confirm' => 'alertify', |
|
| 359 | +], 'dialogs.default'); |
|
| 360 | +// The server request |
|
| 361 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 362 | +return $c->g(ServerRequestCreator::class) |
|
| 363 | + ->fromGlobals() |
|
| 364 | + ->withQueryParams([ |
|
| 365 | + 'jxncall' => json_encode([ |
|
| 366 | + 'type' => 'class', |
|
| 367 | + 'name' => 'Dialog', |
|
| 368 | + 'method' => 'showWith', |
|
| 369 | + 'args' => [], |
|
| 370 | + ]), |
|
| 371 | + ]); |
|
| 372 | +}); |
|
| 373 | + |
|
| 374 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 375 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 376 | + |
|
| 377 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 378 | +$this->assertCount(1, $aCommands); |
|
| 379 | +$this->assertEquals('dialog.modal.show', $aCommands[0]['name']); |
|
| 380 | +} |
|
| 381 | + |
|
| 382 | +/** |
|
| 383 | 383 | * @throws RequestException |
| 384 | 384 | */ |
| 385 | - public function testDialogLibraryHide() |
|
| 386 | - { |
|
| 387 | - jaxon()->setAppOptions([ |
|
| 388 | - 'modal' => 'alertify', |
|
| 389 | - 'alert' => 'alertify', |
|
| 390 | - 'confirm' => 'alertify', |
|
| 391 | - ], 'dialogs.default'); |
|
| 392 | - // The server request |
|
| 393 | - jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 394 | - return $c->g(ServerRequestCreator::class) |
|
| 395 | - ->fromGlobals() |
|
| 396 | - ->withQueryParams([ |
|
| 397 | - 'jxncall' => json_encode([ |
|
| 398 | - 'type' => 'class', |
|
| 399 | - 'name' => 'Dialog', |
|
| 400 | - 'method' => 'hide', |
|
| 401 | - 'args' => [], |
|
| 402 | - ]), |
|
| 403 | - ]); |
|
| 404 | - }); |
|
| 405 | - |
|
| 406 | - $this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 407 | - jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 408 | - |
|
| 409 | - $aCommands = jaxon()->getResponse()->getCommands(); |
|
| 410 | - $this->assertCount(1, $aCommands); |
|
| 411 | - $this->assertEquals('dialog.modal.hide', $aCommands[0]['name']); |
|
| 412 | - $this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 413 | - } |
|
| 414 | - |
|
| 415 | - /** |
|
| 385 | +public function testDialogLibraryHide() |
|
| 386 | +{ |
|
| 387 | +jaxon()->setAppOptions([ |
|
| 388 | +'modal' => 'alertify', |
|
| 389 | +'alert' => 'alertify', |
|
| 390 | +'confirm' => 'alertify', |
|
| 391 | +], 'dialogs.default'); |
|
| 392 | +// The server request |
|
| 393 | +jaxon()->di()->set(ServerRequestInterface::class, function($c) { |
|
| 394 | +return $c->g(ServerRequestCreator::class) |
|
| 395 | + ->fromGlobals() |
|
| 396 | + ->withQueryParams([ |
|
| 397 | + 'jxncall' => json_encode([ |
|
| 398 | + 'type' => 'class', |
|
| 399 | + 'name' => 'Dialog', |
|
| 400 | + 'method' => 'hide', |
|
| 401 | + 'args' => [], |
|
| 402 | + ]), |
|
| 403 | + ]); |
|
| 404 | +}); |
|
| 405 | + |
|
| 406 | +$this->assertTrue(jaxon()->di()->getRequestHandler()->canProcessRequest()); |
|
| 407 | +jaxon()->di()->getRequestHandler()->processRequest(); |
|
| 408 | + |
|
| 409 | +$aCommands = jaxon()->getResponse()->getCommands(); |
|
| 410 | +$this->assertCount(1, $aCommands); |
|
| 411 | +$this->assertEquals('dialog.modal.hide', $aCommands[0]['name']); |
|
| 412 | +$this->assertEquals('dialog', $aCommands[0]['options']['plugin']); |
|
| 413 | +} |
|
| 414 | + |
|
| 415 | +/** |
|
| 416 | 416 | * @throws SetupException |
| 417 | 417 | */ |
| 418 | - public function testConfirmMessageSuccess() |
|
| 419 | - { |
|
| 420 | - jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleDialog', __DIR__ . '/../src/sample.php'); |
|
| 421 | - jaxon()->setAppOption('dialogs.default.alert', 'cute'); |
|
| 422 | - jaxon()->setAppOption('dialogs.default.confirm', 'noty'); |
|
| 423 | - $this->assertEquals( |
|
| 424 | - 'jaxon.exec({"_type":"expr","calls":[{"_type":"func","_name":"SampleDialog.method",' . |
|
| 425 | - '"args":[{"_type":"html","_name":"elt_id"}]}],' . |
|
| 426 | - '"confirm":{"lib":"noty","question":{"title":"","phrase":{"str":"Really?","args":[]}}},' . |
|
| 427 | - '"alert":{"lib":"cute","message":{"type":"success","title":"","phrase":{"str":"No confirm","args":[]}}}})', |
|
| 428 | - rq('SampleDialog')->method(pm()->html('elt_id'))->confirm("Really?") |
|
| 429 | - ->elseSuccess("No confirm")->__toString() |
|
| 430 | - ); |
|
| 431 | - } |
|
| 432 | - |
|
| 433 | - /** |
|
| 418 | +public function testConfirmMessageSuccess() |
|
| 419 | +{ |
|
| 420 | +jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleDialog', __DIR__ . '/../src/sample.php'); |
|
| 421 | +jaxon()->setAppOption('dialogs.default.alert', 'cute'); |
|
| 422 | +jaxon()->setAppOption('dialogs.default.confirm', 'noty'); |
|
| 423 | +$this->assertEquals( |
|
| 424 | +'jaxon.exec({"_type":"expr","calls":[{"_type":"func","_name":"SampleDialog.method",' . |
|
| 425 | + '"args":[{"_type":"html","_name":"elt_id"}]}],' . |
|
| 426 | + '"confirm":{"lib":"noty","question":{"title":"","phrase":{"str":"Really?","args":[]}}},' . |
|
| 427 | + '"alert":{"lib":"cute","message":{"type":"success","title":"","phrase":{"str":"No confirm","args":[]}}}})', |
|
| 428 | +rq('SampleDialog')->method(pm()->html('elt_id'))->confirm("Really?") |
|
| 429 | + ->elseSuccess("No confirm")->__toString() |
|
| 430 | +); |
|
| 431 | +} |
|
| 432 | + |
|
| 433 | +/** |
|
| 434 | 434 | * @throws SetupException |
| 435 | 435 | */ |
| 436 | - public function testConfirmMessageInfo() |
|
| 437 | - { |
|
| 438 | - jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleDialog', __DIR__ . '/../src/sample.php'); |
|
| 439 | - jaxon()->setAppOptions([ |
|
| 440 | - 'alert' => 'cute', |
|
| 441 | - 'confirm' => 'noty', |
|
| 442 | - ], 'dialogs.default'); |
|
| 443 | - $this->assertEquals( |
|
| 444 | - 'jaxon.exec({"_type":"expr","calls":[{"_type":"func","_name":"SampleDialog.method",' . |
|
| 445 | - '"args":[{"_type":"html","_name":"elt_id"}]}],' . |
|
| 446 | - '"confirm":{"lib":"noty","question":{"title":"","phrase":{"str":"Really?","args":[]}}},' . |
|
| 447 | - '"alert":{"lib":"cute","message":{"type":"info","title":"","phrase":{"str":"No confirm","args":[]}}}})', |
|
| 448 | - rq('SampleDialog')->method(pm()->html('elt_id'))->confirm("Really?") |
|
| 449 | - ->elseInfo("No confirm")->__toString() |
|
| 450 | - ); |
|
| 451 | - } |
|
| 452 | - |
|
| 453 | - /** |
|
| 436 | +public function testConfirmMessageInfo() |
|
| 437 | +{ |
|
| 438 | +jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleDialog', __DIR__ . '/../src/sample.php'); |
|
| 439 | +jaxon()->setAppOptions([ |
|
| 440 | +'alert' => 'cute', |
|
| 441 | +'confirm' => 'noty', |
|
| 442 | +], 'dialogs.default'); |
|
| 443 | +$this->assertEquals( |
|
| 444 | +'jaxon.exec({"_type":"expr","calls":[{"_type":"func","_name":"SampleDialog.method",' . |
|
| 445 | + '"args":[{"_type":"html","_name":"elt_id"}]}],' . |
|
| 446 | + '"confirm":{"lib":"noty","question":{"title":"","phrase":{"str":"Really?","args":[]}}},' . |
|
| 447 | + '"alert":{"lib":"cute","message":{"type":"info","title":"","phrase":{"str":"No confirm","args":[]}}}})', |
|
| 448 | +rq('SampleDialog')->method(pm()->html('elt_id'))->confirm("Really?") |
|
| 449 | + ->elseInfo("No confirm")->__toString() |
|
| 450 | +); |
|
| 451 | +} |
|
| 452 | + |
|
| 453 | +/** |
|
| 454 | 454 | * @throws SetupException |
| 455 | 455 | */ |
| 456 | - public function testConfirmMessageWarning() |
|
| 457 | - { |
|
| 458 | - jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleDialog', __DIR__ . '/../src/sample.php'); |
|
| 459 | - jaxon()->setAppOptions([ |
|
| 460 | - 'alert' => 'cute', |
|
| 461 | - 'confirm' => 'noty', |
|
| 462 | - ], 'dialogs.default'); |
|
| 463 | - $this->assertEquals( |
|
| 464 | - 'jaxon.exec({"_type":"expr","calls":[{"_type":"func","_name":"SampleDialog.method",' . |
|
| 465 | - '"args":[{"_type":"html","_name":"elt_id"}]}],' . |
|
| 466 | - '"confirm":{"lib":"noty","question":{"title":"","phrase":{"str":"Really?","args":[]}}},' . |
|
| 467 | - '"alert":{"lib":"cute","message":{"type":"warning","title":"","phrase":{"str":"No confirm","args":[]}}}})', |
|
| 468 | - rq('SampleDialog')->method(pm()->html('elt_id'))->confirm("Really?") |
|
| 469 | - ->elseWarning("No confirm")->__toString() |
|
| 470 | - ); |
|
| 471 | - } |
|
| 472 | - |
|
| 473 | - /** |
|
| 456 | +public function testConfirmMessageWarning() |
|
| 457 | +{ |
|
| 458 | +jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleDialog', __DIR__ . '/../src/sample.php'); |
|
| 459 | +jaxon()->setAppOptions([ |
|
| 460 | +'alert' => 'cute', |
|
| 461 | +'confirm' => 'noty', |
|
| 462 | +], 'dialogs.default'); |
|
| 463 | +$this->assertEquals( |
|
| 464 | +'jaxon.exec({"_type":"expr","calls":[{"_type":"func","_name":"SampleDialog.method",' . |
|
| 465 | + '"args":[{"_type":"html","_name":"elt_id"}]}],' . |
|
| 466 | + '"confirm":{"lib":"noty","question":{"title":"","phrase":{"str":"Really?","args":[]}}},' . |
|
| 467 | + '"alert":{"lib":"cute","message":{"type":"warning","title":"","phrase":{"str":"No confirm","args":[]}}}})', |
|
| 468 | +rq('SampleDialog')->method(pm()->html('elt_id'))->confirm("Really?") |
|
| 469 | + ->elseWarning("No confirm")->__toString() |
|
| 470 | +); |
|
| 471 | +} |
|
| 472 | + |
|
| 473 | +/** |
|
| 474 | 474 | * @throws SetupException |
| 475 | 475 | */ |
| 476 | - public function testConfirmMessageError() |
|
| 477 | - { |
|
| 478 | - jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleDialog', __DIR__ . '/../src/sample.php'); |
|
| 479 | - jaxon()->setAppOptions([ |
|
| 480 | - 'alert' => 'cute', |
|
| 481 | - 'confirm' => 'noty', |
|
| 482 | - ], 'dialogs.default'); |
|
| 483 | - $this->assertEquals( |
|
| 484 | - 'jaxon.exec({"_type":"expr","calls":[{"_type":"func","_name":"SampleDialog.method",' . |
|
| 485 | - '"args":[{"_type":"html","_name":"elt_id"}]}],' . |
|
| 486 | - '"confirm":{"lib":"noty","question":{"title":"","phrase":{"str":"Really?","args":[]}}},' . |
|
| 487 | - '"alert":{"lib":"cute","message":{"type":"error","title":"","phrase":{"str":"No confirm","args":[]}}}})', |
|
| 488 | - rq('SampleDialog')->method(pm()->html('elt_id'))->confirm("Really?") |
|
| 489 | - ->elseError("No confirm")->__toString() |
|
| 490 | - ); |
|
| 491 | - } |
|
| 476 | +public function testConfirmMessageError() |
|
| 477 | +{ |
|
| 478 | +jaxon()->register(Jaxon::CALLABLE_CLASS, 'SampleDialog', __DIR__ . '/../src/sample.php'); |
|
| 479 | +jaxon()->setAppOptions([ |
|
| 480 | +'alert' => 'cute', |
|
| 481 | +'confirm' => 'noty', |
|
| 482 | +], 'dialogs.default'); |
|
| 483 | +$this->assertEquals( |
|
| 484 | +'jaxon.exec({"_type":"expr","calls":[{"_type":"func","_name":"SampleDialog.method",' . |
|
| 485 | + '"args":[{"_type":"html","_name":"elt_id"}]}],' . |
|
| 486 | + '"confirm":{"lib":"noty","question":{"title":"","phrase":{"str":"Really?","args":[]}}},' . |
|
| 487 | + '"alert":{"lib":"cute","message":{"type":"error","title":"","phrase":{"str":"No confirm","args":[]}}}})', |
|
| 488 | +rq('SampleDialog')->method(pm()->html('elt_id'))->confirm("Really?") |
|
| 489 | + ->elseError("No confirm")->__toString() |
|
| 490 | +); |
|
| 491 | +} |
|
| 492 | 492 | } |
@@ -4,9 +4,9 @@ |
||
| 4 | 4 | |
| 5 | 5 | class SampleDialog |
| 6 | 6 | { |
| 7 | - public function myMethod() |
|
| 8 | - { |
|
| 9 | - $xResponse = jaxon()->getResponse(); |
|
| 10 | - $xResponse->alert('This is a response!!'); |
|
| 11 | - } |
|
| 7 | +public function myMethod() |
|
| 8 | +{ |
|
| 9 | +$xResponse = jaxon()->getResponse(); |
|
| 10 | +$xResponse->alert('This is a response!!'); |
|
| 11 | +} |
|
| 12 | 12 | } |
@@ -7,69 +7,69 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Dialog extends CallableClass |
| 9 | 9 | { |
| 10 | - public function success() |
|
| 11 | - { |
|
| 12 | - $this->response->dialog->title('Success')->success('This is a message!!'); |
|
| 13 | - } |
|
| 10 | +public function success() |
|
| 11 | +{ |
|
| 12 | +$this->response->dialog->title('Success')->success('This is a message!!'); |
|
| 13 | +} |
|
| 14 | 14 | |
| 15 | - public function info() |
|
| 16 | - { |
|
| 17 | - $this->response->dialog->title('Info')->info('This is a message!!'); |
|
| 18 | - } |
|
| 15 | +public function info() |
|
| 16 | +{ |
|
| 17 | +$this->response->dialog->title('Info')->info('This is a message!!'); |
|
| 18 | +} |
|
| 19 | 19 | |
| 20 | - public function warning() |
|
| 21 | - { |
|
| 22 | - $this->response->dialog->title('Warning')->warning('This is a message!!'); |
|
| 23 | - } |
|
| 20 | +public function warning() |
|
| 21 | +{ |
|
| 22 | +$this->response->dialog->title('Warning')->warning('This is a message!!'); |
|
| 23 | +} |
|
| 24 | 24 | |
| 25 | - public function error() |
|
| 26 | - { |
|
| 27 | - $this->response->dialog->title('Error')->error('This is a message!!'); |
|
| 28 | - } |
|
| 25 | +public function error() |
|
| 26 | +{ |
|
| 27 | +$this->response->dialog->title('Error')->error('This is a message!!'); |
|
| 28 | +} |
|
| 29 | 29 | |
| 30 | - public function show() |
|
| 31 | - { |
|
| 32 | - $this->response->dialog->show('Dialog', 'This is the dialog content!!', |
|
| 33 | - [['title' => 'Save', 'class' => 'btn', 'click' => $this->rq()->save()->confirm('Save?')]]); |
|
| 34 | - } |
|
| 30 | +public function show() |
|
| 31 | +{ |
|
| 32 | +$this->response->dialog->show('Dialog', 'This is the dialog content!!', |
|
| 33 | +[['title' => 'Save', 'class' => 'btn', 'click' => $this->rq()->save()->confirm('Save?')]]); |
|
| 34 | +} |
|
| 35 | 35 | |
| 36 | - public function showWith() |
|
| 37 | - { |
|
| 38 | - $this->response->dialog->with('bootbox')->show('Dialog', 'This is the dialog content!!', |
|
| 39 | - [['title' => 'Save', 'class' => 'btn', 'click' => $this->rq()->save()->confirm('Save?')]]); |
|
| 40 | - } |
|
| 36 | +public function showWith() |
|
| 37 | +{ |
|
| 38 | +$this->response->dialog->with('bootbox')->show('Dialog', 'This is the dialog content!!', |
|
| 39 | +[['title' => 'Save', 'class' => 'btn', 'click' => $this->rq()->save()->confirm('Save?')]]); |
|
| 40 | +} |
|
| 41 | 41 | |
| 42 | - public function hide() |
|
| 43 | - { |
|
| 44 | - $this->response->dialog->hide(); |
|
| 45 | - } |
|
| 42 | +public function hide() |
|
| 43 | +{ |
|
| 44 | +$this->response->dialog->hide(); |
|
| 45 | +} |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | class TestDialogLibrary extends AbstractLibrary implements LibraryInterface, ConfirmInterface |
| 49 | 49 | { |
| 50 | - /** |
|
| 50 | +/** |
|
| 51 | 51 | * @const The library name |
| 52 | 52 | */ |
| 53 | - public const NAME = 'test'; |
|
| 53 | +public const NAME = 'test'; |
|
| 54 | 54 | |
| 55 | - /** |
|
| 55 | +/** |
|
| 56 | 56 | * @inheritDoc |
| 57 | 57 | */ |
| 58 | - public function getName(): string |
|
| 59 | - { |
|
| 60 | - return self::NAME; |
|
| 61 | - } |
|
| 58 | +public function getName(): string |
|
| 59 | +{ |
|
| 60 | +return self::NAME; |
|
| 61 | +} |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | interface TestInterface |
| 65 | 65 | { |
| 66 | - public function do(); |
|
| 66 | +public function do(); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | class ClassWithInterface implements TestInterface |
| 70 | 70 | { |
| 71 | - public function do() |
|
| 72 | - { |
|
| 73 | - // Do something |
|
| 74 | - } |
|
| 71 | +public function do() |
|
| 72 | +{ |
|
| 73 | +// Do something |
|
| 74 | +} |
|
| 75 | 75 | } |
@@ -63,8 +63,10 @@ |
||
| 63 | 63 | |
| 64 | 64 | interface TestInterface |
| 65 | 65 | { |
| 66 | - public function do(); |
|
| 67 | -} |
|
| 66 | + public function do { |
|
| 67 | + (); |
|
| 68 | + } |
|
| 69 | + } |
|
| 68 | 70 | |
| 69 | 71 | class ClassWithInterface implements TestInterface |
| 70 | 72 | { |
@@ -1,29 +1,29 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'app' => [ |
|
| 5 | - 'dialogs' => [ |
|
| 6 | - 'default' => [ |
|
| 7 | - 'modal' => 'bootbox', |
|
| 8 | - 'alert' => 'noty', |
|
| 9 | - 'confirm' => 'noty', |
|
| 10 | - ], |
|
| 11 | - 'lib' => [ |
|
| 12 | - 'use' => ['alertify', 'bootbox', 'bootstrap', |
|
| 13 | - 'toastr', 'tingle', 'jalert', 'notify', |
|
| 14 | - 'cute', 'noty', 'sweetalert', 'jconfirm'], |
|
| 15 | - ], |
|
| 16 | - 'toastr' => [ |
|
| 17 | - 'options' => [ |
|
| 18 | - 'alert' => [ |
|
| 19 | - 'closeButton' => true, |
|
| 20 | - 'closeDuration' => 0, |
|
| 21 | - 'positionClass' => 'toast-top-center', |
|
| 22 | - ], |
|
| 23 | - ], |
|
| 24 | - ], |
|
| 4 | +'app' => [ |
|
| 5 | +'dialogs' => [ |
|
| 6 | +'default' => [ |
|
| 7 | + 'modal' => 'bootbox', |
|
| 8 | + 'alert' => 'noty', |
|
| 9 | + 'confirm' => 'noty', |
|
| 10 | +], |
|
| 11 | +'lib' => [ |
|
| 12 | + 'use' => ['alertify', 'bootbox', 'bootstrap', |
|
| 13 | + 'toastr', 'tingle', 'jalert', 'notify', |
|
| 14 | + 'cute', 'noty', 'sweetalert', 'jconfirm'], |
|
| 15 | +], |
|
| 16 | +'toastr' => [ |
|
| 17 | + 'options' => [ |
|
| 18 | + 'alert' => [ |
|
| 19 | + 'closeButton' => true, |
|
| 20 | + 'closeDuration' => 0, |
|
| 21 | + 'positionClass' => 'toast-top-center', |
|
| 25 | 22 | ], |
| 26 | 23 | ], |
| 27 | - 'lib' => [ |
|
| 28 | - ], |
|
| 24 | +], |
|
| 25 | +], |
|
| 26 | +], |
|
| 27 | +'lib' => [ |
|
| 28 | +], |
|
| 29 | 29 | ]; |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'app' => [ |
|
| 5 | - 'dialogs' => [ |
|
| 6 | - 'default' => [ |
|
| 7 | - 'confirm' => TestDialogLibrary::NAME, |
|
| 8 | - ], |
|
| 9 | - 'lib' => [ |
|
| 10 | - 'ext' => [ |
|
| 11 | - TestDialogLibrary::NAME => TestDialogLibrary::class, |
|
| 12 | - ], |
|
| 13 | - ], |
|
| 14 | - ], |
|
| 15 | - ], |
|
| 16 | - 'lib' => [ |
|
| 4 | +'app' => [ |
|
| 5 | +'dialogs' => [ |
|
| 6 | +'default' => [ |
|
| 7 | + 'confirm' => TestDialogLibrary::NAME, |
|
| 8 | +], |
|
| 9 | +'lib' => [ |
|
| 10 | + 'ext' => [ |
|
| 11 | + TestDialogLibrary::NAME => TestDialogLibrary::class, |
|
| 17 | 12 | ], |
| 13 | +], |
|
| 14 | +], |
|
| 15 | +], |
|
| 16 | +'lib' => [ |
|
| 17 | +], |
|
| 18 | 18 | ]; |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | Dialog\Library\Butterup::class, // Butterup |
| 56 | 56 | Dialog\Library\IziToast::class, // IziToast |
| 57 | 57 | ]; |
| 58 | - foreach($aLibraries as $sClass) |
|
| 58 | + foreach ($aLibraries as $sClass) |
|
| 59 | 59 | { |
| 60 | 60 | try |
| 61 | 61 | { |
| 62 | 62 | $xDialog->registerLibrary($sClass, $sClass::NAME); |
| 63 | 63 | } |
| 64 | - catch(SetupException $_){} |
|
| 64 | + catch (SetupException $_) {} |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return $xDialog; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | function register(): void |
| 80 | 80 | { |
| 81 | 81 | // Do nothing if running in cli. |
| 82 | - if(php_sapi_name() !== 'cli') |
|
| 82 | + if (php_sapi_name() !== 'cli') |
|
| 83 | 83 | { |
| 84 | 84 | _register(); |
| 85 | 85 | }; |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | try |
| 61 | 61 | { |
| 62 | 62 | $xDialog->registerLibrary($sClass, $sClass::NAME); |
| 63 | - } |
|
| 64 | - catch(SetupException $_){} |
|
| 63 | + } catch(SetupException $_){} |
|
| 65 | 64 | } |
| 66 | 65 | |
| 67 | 66 | return $xDialog; |
@@ -142,15 +142,15 @@ discard block |
||
| 142 | 142 | 'defaults' => $this->xConfigManager->getAppOption('dialogs.default', []), |
| 143 | 143 | ]; |
| 144 | 144 | $aLibrariesOptions = []; |
| 145 | - foreach($this->getLibraries() as $xLibrary) |
|
| 145 | + foreach ($this->getLibraries() as $xLibrary) |
|
| 146 | 146 | { |
| 147 | 147 | $aLibOptions = $xLibrary->helper()->getJsOptions(); |
| 148 | - if(count($aLibOptions) > 0) |
|
| 148 | + if (count($aLibOptions) > 0) |
|
| 149 | 149 | { |
| 150 | 150 | $aLibrariesOptions[$xLibrary->getName()] = $aLibOptions; |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | - if(count($aLibrariesOptions) > 0) |
|
| 153 | + if (count($aLibrariesOptions) > 0) |
|
| 154 | 154 | { |
| 155 | 155 | $aOptions['options'] = $aLibrariesOptions; |
| 156 | 156 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $xJsCode->sJsBefore = $this->getConfigScript(); |
| 168 | 168 | |
| 169 | 169 | $aCodes = []; |
| 170 | - foreach($this->getHelpers() as $xHelper) |
|
| 170 | + foreach ($this->getHelpers() as $xHelper) |
|
| 171 | 171 | { |
| 172 | 172 | $aCodes[] = $xHelper->getScript(); |
| 173 | 173 | $xJsCode->aFiles = array_merge($xJsCode->aFiles, $xHelper->getFiles()); |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function helper(): LibraryHelper |
| 57 | 57 | { |
| 58 | - return $this->xHelper ?: |
|
| 59 | - $this->xHelper = dialog()->getLibraryHelper($this->getName()); |
|
| 58 | + return $this->xHelper ?: $this->xHelper = dialog()->getLibraryHelper($this->getName()); |
|
| 60 | 59 | } |
| 61 | 60 | |
| 62 | 61 | /** |
@@ -110,8 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | private function getAssetUri(string $sOption, string $sFile): ?string |
| 112 | 112 | { |
| 113 | - return !$this->hasOption($sOption) ? "{$this->sUri}/$sFile" : |
|
| 114 | - (trim($this->getOption($sOption)) ?: null); |
|
| 113 | + return !$this->hasOption($sOption) ? "{$this->sUri}/$sFile" : (trim($this->getOption($sOption)) ?: null); |
|
| 115 | 114 | } |
| 116 | 115 | |
| 117 | 116 | /** |
@@ -194,7 +193,7 @@ discard block |
||
| 194 | 193 | */ |
| 195 | 194 | public function getFiles(): array |
| 196 | 195 | { |
| 197 | - if(!$this->getLibOption('js.app.export', false)) |
|
| 196 | + if (!$this->getLibOption('js.app.export', false)) |
|
| 198 | 197 | { |
| 199 | 198 | return []; |
| 200 | 199 | } |