File tree Expand file tree Collapse file tree 3 files changed +73
-2
lines changed
Expand file tree Collapse file tree 3 files changed +73
-2
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * This file is part of Tatter Alerts.
5+ *
6+ * (c) 2021 Tatter Software
7+ *
8+ * For the full copyright and license information, please view
9+ * the LICENSE file that was distributed with this source code.
10+ */
11+
12+ namespace Tests \Support ;
13+
14+ use CodeIgniter \Test \CIUnitTestCase ;
15+ use Config \Services ;
16+
17+ abstract class AlertsTestCase extends CIUnitTestCase
18+ {
19+ protected function setUp (): void
20+ {
21+ Services::reset ();
22+
23+ parent ::setUp ();
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * This file is part of Tatter Alerts.
5+ *
6+ * (c) 2021 Tatter Software
7+ *
8+ * For the full copyright and license information, please view
9+ * the LICENSE file that was distributed with this source code.
10+ */
11+
12+ use Tatter \Alerts \Alerts ;
13+ use Tests \Support \AlertsTestCase ;
14+
15+ /**
16+ * @internal
17+ */
18+ final class LibraryTest extends AlertsTestCase
19+ {
20+ public function testAdd ()
21+ {
22+ $ expected = [
23+ [
24+ 'class ' => 'fruit ' ,
25+ 'text ' => 'banana ' ,
26+ ],
27+ [
28+ 'class ' => 'candy ' ,
29+ 'text ' => 'snickers ' ,
30+ ],
31+ ];
32+
33+ service ('alerts ' )->add ('fruit ' , 'banana ' );
34+ service ('alerts ' )->add ('candy ' , 'snickers ' );
35+
36+ $ this ->assertSame ($ expected , session ('alerts-queue ' ));
37+ }
38+
39+ public function testCss ()
40+ {
41+ $ expected = view ('Tatter\Alerts\Views\css ' , ['prefix ' => 'alerts- ' ]);
42+ $ result = service ('alerts ' )->css ();
43+
44+ $ this ->assertSame ($ expected , $ result );
45+ }
46+ }
Original file line number Diff line number Diff line change 99 * the LICENSE file that was distributed with this source code.
1010 */
1111
12- use CodeIgniter \Test \CIUnitTestCase ;
1312use Tatter \Alerts \Alerts ;
13+ use Tests \Support \AlertsTestCase ;
1414
1515/**
1616 * @internal
1717 */
18- final class ServiceTest extends CIUnitTestCase
18+ final class ServiceTest extends AlertsTestCase
1919{
2020 public function testServiceReturnsLibrary ()
2121 {
You can’t perform that action at this time.
0 commit comments