-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11a853e
commit 7976d56
Showing
6 changed files
with
168 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/unit/Framework/Assert/assertContainsNotOnlyNullTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <sebastian@phpunit.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\Framework; | ||
|
||
use PHPUnit\Framework\Attributes\CoversMethod; | ||
use PHPUnit\Framework\Attributes\DataProviderExternal; | ||
use PHPUnit\Framework\Attributes\Small; | ||
use PHPUnit\Framework\Attributes\TestDox; | ||
|
||
#[CoversMethod(Assert::class, 'assertContainsNotOnlyNull')] | ||
#[TestDox('assertContainsNotOnlyNull()')] | ||
#[Small] | ||
final class assertContainsNotOnlyNullTest extends TestCase | ||
{ | ||
#[DataProviderExternal(assertContainsOnlyNullTest::class, 'failureProvider')] | ||
public function testSucceedsWhenConstraintEvaluatesToTrue(iterable $haystack): void | ||
{ | ||
$this->assertContainsNotOnlyNull($haystack); | ||
} | ||
|
||
#[DataProviderExternal(assertContainsOnlyNullTest::class, 'successProvider')] | ||
public function testFailsWhenConstraintEvaluatesToFalse(iterable $haystack): void | ||
{ | ||
$this->expectException(AssertionFailedError::class); | ||
|
||
$this->assertContainsNotOnlyNull($haystack); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
tests/unit/Framework/Assert/assertContainsOnlyNullTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <sebastian@phpunit.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\Framework; | ||
|
||
use PHPUnit\Framework\Attributes\CoversMethod; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use PHPUnit\Framework\Attributes\Small; | ||
use PHPUnit\Framework\Attributes\TestDox; | ||
|
||
#[CoversMethod(Assert::class, 'assertContainsOnlyNull')] | ||
#[TestDox('assertContainsOnlyNull()')] | ||
#[Small] | ||
final class assertContainsOnlyNullTest extends TestCase | ||
{ | ||
/** | ||
* @return non-empty-list<array{0: iterable}> | ||
*/ | ||
public static function successProvider(): array | ||
{ | ||
return [ | ||
[[null]], | ||
]; | ||
} | ||
|
||
/** | ||
* @return non-empty-list<array{0: iterable}> | ||
*/ | ||
public static function failureProvider(): array | ||
{ | ||
return [ | ||
[[true]], | ||
]; | ||
} | ||
|
||
#[DataProvider('successProvider')] | ||
public function testSucceedsWhenConstraintEvaluatesToTrue(iterable $haystack): void | ||
{ | ||
$this->assertContainsOnlyNull($haystack); | ||
} | ||
|
||
#[DataProvider('failureProvider')] | ||
public function testFailsWhenConstraintEvaluatesToFalse(iterable $haystack): void | ||
{ | ||
$this->expectException(AssertionFailedError::class); | ||
|
||
$this->assertContainsOnlyNull($haystack); | ||
} | ||
} |