-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAssertsManyTest.php
More file actions
34 lines (29 loc) · 1015 Bytes
/
AssertsManyTest.php
File metadata and controls
34 lines (29 loc) · 1015 Bytes
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
<?php
declare(strict_types=1);
namespace Ziadoz\AssertableHtml\Tests\Unit\Concerns\Asserts;
use PHPUnit\Framework\Assert as PHPUnit;
use PHPUnit\Framework\AssertionFailedError;
use PHPUnit\Framework\TestCase;
use Ziadoz\AssertableHtml\Concerns\AssertsMany;
class AssertsManyTest extends TestCase
{
public function test_asserts_many(): void
{
try {
$object = $this->getAssertsMany();
$object->assertMany(function () {
PHPUnit::assertSame('Foo', 'Bar', 'Foo is not Bar');
}, 'The test assertion failed');
} catch (AssertionFailedError $exception) {
$this->assertSame('The test assertion failed', $exception->getMessage());
$this->assertSame('Foo is not Bar' . "\n" . 'Failed asserting that two strings are identical.', $exception->getPrevious()->getMessage());
}
}
private function getAssertsMany(): object
{
return new class
{
use AssertsMany;
};
}
}