-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCase.php
More file actions
141 lines (127 loc) · 5.47 KB
/
TestCase.php
File metadata and controls
141 lines (127 loc) · 5.47 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
/**
* @author Foma Tuturov <fomiash@yandex.ru>
*/
declare(strict_types=1);
namespace Phphleb\TestO;
use Phphleb\TestO\Tests\ArrayEqualsTest;
class TestCase
{
private array $tests = [];
/**
* @internal
*/
final public function _getTestResults(): array
{
return $this->tests;
}
/**
* @internal
*/
final public function _setExpectNextMethod(): void
{
$this->tests = [];
}
/**
* Calling check for a positive value.
*
* Вызов проверки на положительное значение.
*
* @param bool $condition - the result of a fulfilled condition.
* - результат выполненного условия.
*
* @param string $message - message to be output if the test is not successful.
* - сообщение для вывода в случае если тест не успешен.
*/
final public function assertTrue(bool $condition, string $message = ''): void
{
$this->tests[] = ['AssertTrueTest', $condition === true, $message];
}
/**
* Calling a check for a negative value.
*
* Вызов проверки на отрицательное значение.
*
* @param bool $condition - the result of a fulfilled condition.
* - результат выполненного условия.
*
* @param string $message - message to be output if the test is not successful.
* - сообщение для вывода в случае если тест не успешен.
*/
final public function assertFalse(bool $condition, string $message = ''): void
{
$this->tests[] = ['AssertFalseTest', $condition === false, $message];
}
/**
* Calls to compare two values for equality with strict type checking.
*
* Вызов сравнения двух значений на равенство со строгой проверкой типов.
*
* @param bool|string|int|float $expected - the first value being compared.
* - первое сравниваемое значение.
*
* @param bool|string|int|float $actual - second value being compared.
* - второе сравниваемое значение.
*
* @param string $message - message to be output if the test is not successful.
* - сообщение для вывода в случае если тест не успешен.
*/
final public function assertEquals(bool|string|int|float $expected, bool|string|int|float $actual, string $message = ''): void
{
$this->tests[] = ['AssertEqualsTest', $expected === $actual, $message];
}
/**
* Call to compare two values for inequality with strict type checking.
*
* Вызов сравнения двух значений на неравенство со строгой проверкой типов.
*
* @param bool|string|int|float $expected - the first value being compared.
* - первое сравниваемое значение.
*
* @param bool|string|int|float $actual - second value being compared.
* - второе сравниваемое значение.
*
* @param string $message - message to be output if the test is not successful.
* - сообщение для вывода в случае если тест не успешен.
*/
final public function assertNotEquals(bool|string|int|float $expected, bool|string|int|float $actual, string $message = ''): void
{
$this->tests[] = ['AssertNotEqualsTest', $expected !== $actual, $message];
}
/**
* Calling a check to compare the contents of two arrays.
* In associative arrays, the order of the keys does not matter for comparison.
*
* Вызов проверки на сравнение содержимого двух массивов.
* В ассоциативных массивах порядок ключей не имеет значения для сравнения.
*
* @param array $expected - the first array to be compared.
* - первый сравниваемый массив.
*
* @param array $actual - the second array to compare.
* - второй сравниваемый массив.
*
* @param string $message - message to be output if the test is not successful.
* - сообщение для вывода в случае если тест не успешен.
*/
final public function assertArrayEquals(array $expected, array $actual, string $message = ''): void
{
$this->tests[] = ['assertArrayEqualsTest', ArrayEqualsTest::check($expected, $actual), $message];
}
/**
* Executed before each test method in the class.
*
* Выполняется до каждого тестового метода в классе.
*/
public function setUp()
{
}
/**
* Executed after each test method in the class.
*
* Выполняется после каждого тестового метода в классе.
*/
public function tearDown()
{
}
}