mirror of
https://github.com/pestphp/pest.git
synced 2026-03-12 10:47:25 +01:00
Merge branch '2.x' into 3.x
This commit is contained in:
@ -467,6 +467,18 @@ final class Expectation
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts that the value is a list.
|
||||||
|
*
|
||||||
|
* @return self<TValue>
|
||||||
|
*/
|
||||||
|
public function toBeList(string $message = ''): self
|
||||||
|
{
|
||||||
|
Assert::assertIsList($this->value, $message);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts that the value is of type bool.
|
* Asserts that the value is of type bool.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace Pest;
|
|||||||
|
|
||||||
function version(): string
|
function version(): string
|
||||||
{
|
{
|
||||||
return '3.0.0-dev-0007';
|
return '3.0.0-dev-0008';
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDirectory(string $file = ''): string
|
function testDirectory(string $file = ''): string
|
||||||
|
|||||||
@ -6,5 +6,5 @@ use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
|||||||
|
|
||||||
abstract class TestCase extends BaseTestCase
|
abstract class TestCase extends BaseTestCase
|
||||||
{
|
{
|
||||||
use CreatesApplication;
|
//
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Pest Testing Framework 3.0.0-dev-0007.
|
Pest Testing Framework 3.0.0-dev-0008.
|
||||||
|
|
||||||
USAGE: pest <file> [options]
|
USAGE: pest <file> [options]
|
||||||
|
|
||||||
@ -30,11 +30,11 @@
|
|||||||
--exclude-group [name] ........... Exclude tests from the specified group(s)
|
--exclude-group [name] ........... Exclude tests from the specified group(s)
|
||||||
--covers [name] ................. Only run tests that intend to cover [name]
|
--covers [name] ................. Only run tests that intend to cover [name]
|
||||||
--uses [name] ..................... Only run tests that intend to use [name]
|
--uses [name] ..................... Only run tests that intend to use [name]
|
||||||
--list-test-files ................................ List available test files
|
--list-test-files ................................ List available test files
|
||||||
--list-tests .......................................... List available tests
|
--list-tests .......................................... List available tests
|
||||||
--list-tests-xml [file] ................. List available tests in XML format
|
--list-tests-xml [file] ................. List available tests in XML format
|
||||||
--filter [pattern] ............................... Filter which tests to run
|
--filter [pattern] ............................... Filter which tests to run
|
||||||
--exclude-filter [pattern] .. Exclude tests for the specified filter pattern
|
--exclude-filter [pattern] .. Exclude tests for the specified filter pattern
|
||||||
--test-suffix [suffixes] Only search for test in files with specified suffix(es). Default: Test.php,.phpt
|
--test-suffix [suffixes] Only search for test in files with specified suffix(es). Default: Test.php,.phpt
|
||||||
|
|
||||||
EXECUTION OPTIONS:
|
EXECUTION OPTIONS:
|
||||||
@ -107,8 +107,8 @@
|
|||||||
--coverage-html [dir] Write code coverage report in HTML format to directory
|
--coverage-html [dir] Write code coverage report in HTML format to directory
|
||||||
--coverage-php [file] .......... Write serialized code coverage data to file
|
--coverage-php [file] .......... Write serialized code coverage data to file
|
||||||
--coverage-text=[file] Write code coverage report in text format to file [default: standard output]
|
--coverage-text=[file] Write code coverage report in text format to file [default: standard output]
|
||||||
--only-summary-for-coverage-text Option for code coverage report in text format: only show summary
|
--only-summary-for-coverage-text Option for code coverage report in text format: only show summary
|
||||||
--show-uncovered-for-coverage-text Option for code coverage report in text format: show uncovered files
|
--show-uncovered-for-coverage-text Option for code coverage report in text format: show uncovered files
|
||||||
--coverage-xml [dir] . Write code coverage report in XML format to directory
|
--coverage-xml [dir] . Write code coverage report in XML format to directory
|
||||||
--warm-coverage-cache ........................... Warm static analysis cache
|
--warm-coverage-cache ........................... Warm static analysis cache
|
||||||
--coverage-filter [dir] ........... Include [dir] in code coverage reporting
|
--coverage-filter [dir] ........... Include [dir] in code coverage reporting
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
|
|
||||||
Pest Testing Framework 3.0.0-dev-0007.
|
Pest Testing Framework 3.0.0-dev-0008.
|
||||||
|
|
||||||
|
|||||||
@ -523,6 +523,12 @@
|
|||||||
✓ passes with strings
|
✓ passes with strings
|
||||||
✓ failures
|
✓ failures
|
||||||
✓ failures with custom message
|
✓ failures with custom message
|
||||||
|
✓ not failures
|
||||||
|
|
||||||
|
PASS Tests\Features\Expect\toBeList
|
||||||
|
✓ pass
|
||||||
|
✓ failures
|
||||||
|
✓ failures with custom message
|
||||||
✓ not failures
|
✓ not failures
|
||||||
|
|
||||||
PASS Tests\Features\Expect\toBeLowercase
|
PASS Tests\Features\Expect\toBeLowercase
|
||||||
@ -1461,4 +1467,4 @@
|
|||||||
WARN Tests\Visual\Version
|
WARN Tests\Visual\Version
|
||||||
- visual snapshot of help command output
|
- visual snapshot of help command output
|
||||||
|
|
||||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1042 passed (2563 assertions)
|
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 24 skipped, 1042 passed (2563 assertions)
|
||||||
|
|||||||
21
tests/Features/Expect/toBeList.php
Normal file
21
tests/Features/Expect/toBeList.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use PHPUnit\Framework\ExpectationFailedException;
|
||||||
|
|
||||||
|
test('pass', function () {
|
||||||
|
expect([1, 2, 3])->toBeList();
|
||||||
|
expect(['a' => 1, 'b' => 2, 'c' => 3])->not->toBeList();
|
||||||
|
expect('1, 2, 3')->not->toBeList();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('failures', function () {
|
||||||
|
expect(null)->toBeList();
|
||||||
|
})->throws(ExpectationFailedException::class);
|
||||||
|
|
||||||
|
test('failures with custom message', function () {
|
||||||
|
expect(null)->toBeList('oh no!');
|
||||||
|
})->throws(ExpectationFailedException::class, 'oh no!');
|
||||||
|
|
||||||
|
test('not failures', function () {
|
||||||
|
expect(['a', 'b', 'c'])->not->toBeList();
|
||||||
|
})->throws(ExpectationFailedException::class);
|
||||||
Reference in New Issue
Block a user