-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathGlobalFunctionsTest.php
More file actions
53 lines (43 loc) · 1.26 KB
/
GlobalFunctionsTest.php
File metadata and controls
53 lines (43 loc) · 1.26 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
<?php
namespace Rareloop\Lumberjack\Test;
use Mockery;
use PHPUnit\Framework\TestCase;
use Rareloop\Lumberjack\Helpers;
/**
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*/
class GlobalFunctionsTest extends TestCase
{
use \Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
protected function setUp(): void
{
include_once(__DIR__ . '/../../src/functions.php');
parent::setUp();
}
/**
* @test
* @dataProvider globalHelperFunctions
*/
public function global_functions_are_registered($function)
{
$this->assertTrue(function_exists($function));
}
/**
* @test
* @dataProvider globalHelperFunctions
*/
public function global_functions_proxy_calls_to_static_functions($function)
{
$helpers = Mockery::mock('alias:' . Helpers::class);
$helpers->shouldReceive($function)->withArgs(['param1', 'param2'])->once();
$function('param1', 'param2');
}
public static function globalHelperFunctions()
{
$reflection = new \ReflectionClass(Helpers::class);
return collect($reflection->getMethods(\ReflectionMethod::IS_STATIC))->map(function ($function) {
return [ $function->name ];
})->toArray();
}
}