feat(expect): adds toBe

This commit is contained in:
Nuno Maduro
2020-07-06 00:32:12 +02:00
parent 3eb0a95955
commit 01b9bab55f
5 changed files with 145 additions and 2 deletions

View File

@ -2,6 +2,11 @@
PASS Tests\CustomTestCase\ExecutedTest
✓ that gets executed
PASS Tests\Expect\ToBe
✓ strict comparisons
✓ failures
✓ not failures
PASS Tests\Features\AfterAll
✓ deletes file after all
@ -167,5 +172,5 @@
WARN Tests\Visual\Success
- visual snapshot of test suite on success
Tests: 6 skipped, 96 passed
Time: 3.43s
Tests: 6 skipped, 99 passed
Time: 3.62s

19
tests/Expect/ToBe.php Normal file
View File

@ -0,0 +1,19 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('strict comparisons', function () {
$nuno = new stdClass();
$dries = new stdClass();
expect($nuno)->toBe($nuno);
expect($nuno)->not->toBe($dries);
});
test('failures', function () {
expect(1)->toBe(2);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(1)->not->toBe(1);
})->throws(ExpectationFailedException::class);