Skip to content

Commit 8bcd68d

Browse files
committed
test: Cover Asser::equals and Assert::notEquals
1 parent 1bdbca2 commit 8bcd68d

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Testo\Assert;
6+
7+
use Testo\Assert;
8+
use Testo\Attribute\Test;
9+
10+
/**
11+
* Assertion examples.
12+
*/
13+
final class AssertEquals
14+
{
15+
#[Test]
16+
public function numbers(): void
17+
{
18+
Assert::equals(1, 1);
19+
Assert::equals(1, 1.0);
20+
Assert::equals(1.0, 1);
21+
Assert::equals("2", 2);
22+
}
23+
24+
#[Test]
25+
public function arrays(): void
26+
{
27+
# Same
28+
Assert::equals([1, 2], [1, 2]);
29+
Assert::equals(
30+
['a' => 1, 'b' => 2],
31+
['a' => 1, 'b' => 2],
32+
);
33+
# Different order
34+
Assert::equals(
35+
['b' => 2, 'a' => 1],
36+
['a' => 1, 'b' => 2],
37+
);
38+
}
39+
40+
#[Test]
41+
public function objects(): void
42+
{
43+
Assert::equals(
44+
(object) ['a' => 1, 'b' => 2],
45+
(object) ['b' => 2, 'a' => 1],
46+
);
47+
}
48+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Testo\Assert;
6+
7+
use Testo\Assert;
8+
use Testo\Attribute\Test;
9+
10+
/**
11+
* Assertion examples.
12+
*/
13+
final class AssertNotEquals
14+
{
15+
#[Test]
16+
public function numbers(): void
17+
{
18+
Assert::notEquals(1, 2);
19+
}
20+
21+
#[Test]
22+
public function arrays(): void
23+
{
24+
Assert::notEquals([2, 1], [1, 2]);
25+
}
26+
27+
#[Test]
28+
public function objects(): void
29+
{
30+
Assert::notEquals(
31+
(object) ['a' => 1],
32+
(object) ['a' => 2],
33+
);
34+
}
35+
}

0 commit comments

Comments
 (0)