-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathSettingTest.php
More file actions
67 lines (55 loc) · 2.15 KB
/
Copy pathSettingTest.php
File metadata and controls
67 lines (55 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
namespace Bow\Tests\Console;
use Bow\Configuration\Loader as ConfigurationLoader;
use Bow\Console\Setting;
use Bow\Tests\Config\TestingConfiguration;
class SettingTest extends \PHPUnit\Framework\TestCase
{
private static ConfigurationLoader $kernel;
private static Setting $setting;
public static function setUpBeforeClass(): void
{
static::$kernel = TestingConfiguration::getConfig();
static::$setting = new Setting(static::$kernel->getBasePath());
}
/**
* @dataProvider get_the_directories
*/
public function test_set_the_model_directory(string $method, string $directory)
{
$model_directory = TESTING_RESOURCE_BASE_DIRECTORY . $directory;
$set_method = 'set' . ucfirst($method) . 'Directory';
$get_method = 'get' . ucfirst($method) . 'Directory';
static::$setting->{$set_method}($model_directory);
$this->assertNotNull(static::$setting->{$get_method}());
$this->assertEquals($model_directory, static::$setting->{$get_method}());
}
public function test_set_the_validation_directory()
{
$model_directory = TESTING_RESOURCE_BASE_DIRECTORY . '/app/Validations';
static::$setting->setValidationDirectory($model_directory);
$this->assertNotNull(static::$setting->getValidationDirectory());
$this->assertEquals($model_directory, static::$setting->getValidationDirectory());
}
public function get_the_directories()
{
return [
["model", "/app/Models"],
["middleware", "/app/Middlewares"],
["validation", "/app/Validations"],
["Package", "/app/Configurations"],
["controller", "/app/Controllers"],
["migration", "/app/Migrations"],
["exception", "/app/Exceptions"],
["service", "/app/Services"],
["Event", "/app/Events"],
["EventListener", "/app/Listeners"],
["task", "/app/Tasks"],
["command", "/app/Commands"],
["seeder", "/seeders"],
["component", "/frontend"],
["config", "/config"],
["public", "/public"],
];
}
}