Skip to content

Commit 5d5627e

Browse files
committed
Consolidate and fix tests
1 parent 7995363 commit 5d5627e

5 files changed

Lines changed: 21 additions & 77 deletions

File tree

.github/workflows/test-phpunit.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/Helpers/setting_helper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
if (! function_exists('setting'))
44
{
55
/**
6-
* Provides a convenience interface to the
7-
* Bonfire/Settings/Settings class.
6+
* Provides a convenience interface to the Settings service.
87
*
98
* @param string|null $field
109
* @param null $value

tests/HelperTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,11 @@ class HelperTest extends TestCase
1111
{
1212
use DatabaseTestTrait;
1313

14-
protected $namespace = 'Sparks\Settings';
15-
protected $refresh = true;
16-
protected $table;
17-
1814
public function setUp(): void
1915
{
2016
parent::setUp();
2117

22-
$this->table = config('Settings')->database['table'];
23-
helper('setting');
18+
helper(['setting']);
2419
}
2520

2621
public function testReturnsServiceByDefault()

tests/SettingsTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ class SettingsTest extends TestCase
1111
{
1212
use DatabaseTestTrait;
1313

14-
protected $namespace = 'Sparks\Settings';
15-
protected $refresh = true;
16-
protected $table;
17-
18-
public function setUp(): void
19-
{
20-
parent::setUp();
21-
22-
$this->table = config('Settings')->database['table'];
23-
}
24-
2514
public function testSettingsGetsFromConfig()
2615
{
2716
$settings = new Settings();

tests/_support/TestCase.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,27 @@
44

55
use CodeIgniter\Test\CIUnitTestCase;
66

7-
class TestCase extends CIUnitTestCase
7+
abstract class TestCase extends CIUnitTestCase
88
{
9+
protected $namespace = 'Sparks\Settings';
10+
protected $refresh = true;
911

12+
/**
13+
* @var string
14+
*/
15+
protected $table;
1016

11-
protected function setUp(): void
12-
{
13-
parent::setUp();
17+
public function setUp(): void
18+
{
19+
parent::setUp();
1420

15-
$_SESSION = [];
16-
}
21+
$this->table = config('Settings')->database['table'];
22+
}
23+
24+
public function tearDown(): void
25+
{
26+
parent::tearDown();
27+
28+
$this->resetServices();
29+
}
1730
}

0 commit comments

Comments
 (0)