forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCase.php
More file actions
65 lines (57 loc) · 1.52 KB
/
TestCase.php
File metadata and controls
65 lines (57 loc) · 1.52 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
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Artisan;
abstract class TestCase extends BaseTestCase
{
use DatabaseTransactions;
use CreatesApplication;
public $withPermissions = false;
/**
* Run additional setUps from traits.
*
*/
protected function setUp(): void
{
parent::setUp();
foreach (get_class_methods($this) as $method) {
$imethod = strtolower($method);
if (strpos($imethod, 'setup') === 0 && $imethod !== 'setup') {
$this->$method();
}
}
}
/**
* Run additional tearDowns from traits.
*
*/
protected function tearDown(): void
{
parent::tearDown();
foreach (get_class_methods($this) as $method) {
$imethod = strtolower($method);
if (strpos($imethod, 'teardown') === 0 && $imethod !== 'teardown') {
$this->$method();
}
}
}
protected function withPersonalAccessClient()
{
$clients = app()->make('Laravel\Passport\ClientRepository');
try {
$clients->personalAccessClient();
} catch (\RuntimeException $e) {
Artisan::call('passport:install');
}
}
/**
* Connections transacts
*
* @return array
*/
protected function connectionsToTransact()
{
return ['processmaker', 'data'];
}
}