Skip to content

Commit 1b1fd7f

Browse files
committed
test refactor
1 parent bccb2d7 commit 1b1fd7f

File tree

4 files changed

+34
-28
lines changed

4 files changed

+34
-28
lines changed

tests/ClearThemeTest.php

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

55
use Illuminate\Support\Facades\View;
66
use Qirolab\Theme\Theme;
7+
use Qirolab\Theme\ThemeServiceProvider;
78

89
class ClearThemeTest extends TestCase
910
{
10-
/**
11-
* Define environment setup.
12-
*
13-
* @param \Illuminate\Foundation\Application $app
14-
* @return void
15-
*/
16-
protected function getEnvironmentSetUp($app)
11+
protected function getPackageProviders($app)
1712
{
1813
$app['config']->set('theme.active', 'child-theme');
1914
$app['config']->set('theme.parent', 'parent-theme');
15+
16+
return [
17+
ThemeServiceProvider::class,
18+
];
2019
}
2120

2221
/** @test **/

tests/ParentThemeTest.php

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

55
use Illuminate\Support\Facades\View;
66
use Qirolab\Theme\Theme;
7+
use Qirolab\Theme\ThemeServiceProvider;
78

89
class ParentThemeTest extends TestCase
910
{
10-
/**
11-
* Define environment setup.
12-
*
13-
* @param \Illuminate\Foundation\Application $app
14-
* @return void
15-
*/
16-
protected function getEnvironmentSetUp($app)
11+
protected function getPackageProviders($app)
1712
{
1813
$app['config']->set('theme.active', 'child-theme');
1914
$app['config']->set('theme.parent', 'parent-theme');
15+
16+
return [
17+
ThemeServiceProvider::class,
18+
];
2019
}
2120

2221
/** @test **/

tests/ThemeMiddlewareTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Support\Facades\Route;
66
use Qirolab\Theme\Middleware\ThemeMiddleware;
77
use Qirolab\Theme\Theme;
8+
use Qirolab\Theme\ThemeServiceProvider;
89

910
class ThemeMiddlewareTest extends TestCase
1011
{
@@ -21,16 +22,14 @@ public function setUp(): void
2122
})->middleware('theme:frontend,parent');
2223
}
2324

24-
/**
25-
* Define environment setup.
26-
*
27-
* @param \Illuminate\Foundation\Application $app
28-
* @return void
29-
*/
30-
protected function getEnvironmentSetUp($app)
25+
protected function getPackageProviders($app)
3126
{
3227
$app['router']->aliasMiddleware('theme', ThemeMiddleware::class);
3328
$app['config']->set('theme.active', 'default');
29+
30+
return [
31+
ThemeServiceProvider::class,
32+
];
3433
}
3534

3635
/** @test **/

tests/ThemeTest.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,18 @@
44

55
use Illuminate\Support\Facades\View;
66
use Qirolab\Theme\Theme;
7+
use Qirolab\Theme\ThemeServiceProvider;
78
use Qirolab\Theme\ThemeViewFinder;
89

910
class ThemeTest extends TestCase
1011
{
11-
/**
12-
* Define environment setup.
13-
*
14-
* @param \Illuminate\Foundation\Application $app
15-
* @return void
16-
*/
17-
protected function getEnvironmentSetUp($app)
12+
protected function getPackageProviders($app)
1813
{
1914
$app['config']->set('theme.active', 'default');
15+
16+
return [
17+
ThemeServiceProvider::class,
18+
];
2019
}
2120

2221
/** @test **/
@@ -117,4 +116,14 @@ public function on_change_view_finder_active_theme_returns_null()
117116

118117
$this->assertNull(Theme::active());
119118
}
119+
120+
/** @test **/
121+
public function it_returns_all_view_paths()
122+
{
123+
$this->assertCount(2, Theme::getViewPaths());
124+
125+
Theme::set('child', 'parent');
126+
127+
$this->assertCount(3, Theme::getViewPaths());
128+
}
120129
}

0 commit comments

Comments
 (0)