-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathTestCase.invalidMethods.phpt
58 lines (42 loc) · 1.03 KB
/
TestCase.invalidMethods.phpt
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
<?php
declare(strict_types=1);
use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
class MyTest extends Tester\TestCase
{
protected function testProtected()
{
}
private function testPrivate()
{
}
public function notTesting()
{
}
}
$test = new MyTest;
Assert::exception(
fn() => $test->runTest('testProtected'),
Tester\TestCaseException::class,
'Method testProtected is not public. Make it public or rename it.',
);
Assert::exception(
fn() => $test->runTest('testPrivate'),
Tester\TestCaseException::class,
'Method testPrivate is not public. Make it public or rename it.',
);
Assert::exception(
fn() => $test->runTest('testUndefined'),
Tester\TestCaseException::class,
"Method 'testUndefined' does not exist.",
);
Assert::exception(
fn() => $test->runTest('notTesting'),
Tester\TestCaseException::class,
"Method 'notTesting' is not a testing method.",
);
Assert::exception(
fn() => $test->runTest('notTestingUndefined'),
Tester\TestCaseException::class,
"Method 'notTestingUndefined' does not exist.",
);