mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a43b86d9eb | |||
| 5279d5e913 | |||
| df7fb92e03 | |||
| 95c3418313 | |||
| 67a8be9347 | |||
| 5d7f262f4a |
3
.github/workflows/static.yml
vendored
3
.github/workflows/static.yml
vendored
@ -22,9 +22,6 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: composer update --no-interaction --no-progress
|
||||
|
||||
- name: Run Rector
|
||||
run: vendor/bin/rector process src --dry-run
|
||||
|
||||
- name: Run PHP-CS-Fixer
|
||||
run: vendor/bin/php-cs-fixer fix -v --allow-risky=yes --dry-run
|
||||
|
||||
|
||||
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [v0.3.16 (2020-12-13)](https://github.com/pestphp/pest/compare/v0.3.15...v0.3.16)
|
||||
### Changed
|
||||
- Moves expectation API for external plugin ([5d7f262](https://github.com/pestphp/pest/commit/5d7f262f4ab280a660a85900f402eebb23abfda8))
|
||||
|
||||
## [v0.3.15 (2020-12-04)](https://github.com/pestphp/pest/compare/v0.3.14...v0.3.15)
|
||||
### Added
|
||||
- Support for PHPUnit 9.5.0 ([#234](https://github.com/pestphp/pest/pull/234))
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
"nunomaduro/collision": "^5.0",
|
||||
"pestphp/pest-plugin": "^0.3",
|
||||
"pestphp/pest-plugin-coverage": "^0.3",
|
||||
"pestphp/pest-plugin-expectations": "^0.3.2",
|
||||
"pestphp/pest-plugin-init": "^0.3",
|
||||
"phpunit/phpunit": ">= 9.3.7 <= 9.5.0"
|
||||
},
|
||||
@ -29,7 +30,7 @@
|
||||
"Pest\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/globals.php",
|
||||
"src/Functions.php",
|
||||
"src/Pest.php"
|
||||
]
|
||||
},
|
||||
@ -44,7 +45,7 @@
|
||||
"require-dev": {
|
||||
"illuminate/console": "^7.16.1",
|
||||
"illuminate/support": "^7.16.1",
|
||||
"laravel/dusk": "^6.9.0",
|
||||
"laravel/dusk": "^6.9.1",
|
||||
"mockery/mockery": "^1.4.1",
|
||||
"pestphp/pest-dev-tools": "dev-master"
|
||||
},
|
||||
@ -58,8 +59,8 @@
|
||||
"bin/pest"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "rector process src && php-cs-fixer fix -v",
|
||||
"test:lint": "php-cs-fixer fix -v --dry-run && rector process src --dry-run",
|
||||
"lint": "php-cs-fixer fix -v",
|
||||
"test:lint": "php-cs-fixer fix -v --dry-run",
|
||||
"test:types": "phpstan analyse --ansi --memory-limit=0",
|
||||
"test:unit": "php bin/pest --colors=always --exclude-group=integration",
|
||||
"test:integration": "php bin/pest --colors=always --group=integration",
|
||||
|
||||
@ -7,14 +7,13 @@ parameters:
|
||||
level: max
|
||||
paths:
|
||||
- src
|
||||
excludes_analyse:
|
||||
- src/globals.php
|
||||
|
||||
checkMissingIterableValueType: true
|
||||
checkGenericClassInNonGenericObjectType: false
|
||||
reportUnmatchedIgnoredErrors: true
|
||||
|
||||
ignoreErrors:
|
||||
- "#type mixed is not subtype of native#"
|
||||
- "#Undefined variable: \\$this#"
|
||||
- "#is not allowed to extend#"
|
||||
- "#Language construct eval#"
|
||||
|
||||
35
rector.php
35
rector.php
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
SetList::ACTION_INJECTION_TO_CONSTRUCTOR_INJECTION,
|
||||
SetList::ARRAY_STR_FUNCTIONS_TO_STATIC_CALL,
|
||||
SetList::CODE_QUALITY,
|
||||
SetList::PHP_53,
|
||||
SetList::PHP_54,
|
||||
SetList::PHP_56,
|
||||
SetList::PHP_70,
|
||||
SetList::PHP_71,
|
||||
SetList::PHP_72,
|
||||
SetList::PHP_73,
|
||||
SetList::PHPSTAN,
|
||||
SetList::PHPUNIT_CODE_QUALITY,
|
||||
SetList::SOLID,
|
||||
]);
|
||||
|
||||
$parameters->set(Option::PATHS, [__DIR__ . '/src', __DIR__ . '/tests']);
|
||||
$parameters->set(Option::EXCLUDE_RECTORS, [
|
||||
StaticCallOnNonStaticToInstanceCallRector::class,
|
||||
]);
|
||||
};
|
||||
@ -21,6 +21,7 @@ final class LoadStructure
|
||||
* @var array<int, string>
|
||||
*/
|
||||
private const STRUCTURE = [
|
||||
'Expectations.php',
|
||||
'Datasets.php',
|
||||
'Helpers.php',
|
||||
'Pest.php',
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest\Concerns;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
trait Extendable
|
||||
{
|
||||
/**
|
||||
* @var array<string, Closure>
|
||||
*/
|
||||
private static $extends = [];
|
||||
|
||||
/**
|
||||
* Register a custom extend.
|
||||
*/
|
||||
public static function extend(string $name, Closure $extend): void
|
||||
{
|
||||
static::$extends[$name] = $extend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if extend is registered.
|
||||
*/
|
||||
public static function hasExtend(string $name): bool
|
||||
{
|
||||
return array_key_exists($name, static::$extends);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically handle calls to the class.
|
||||
*
|
||||
* @param array<int, mixed> $parameters
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function __call(string $method, array $parameters)
|
||||
{
|
||||
if (!static::hasExtend($method)) {
|
||||
throw new BadMethodCallException(sprintf('Method %s::%s does not exist.', static::class, $method));
|
||||
}
|
||||
|
||||
$extend = static::$extends[$method]->bindTo($this, static::class);
|
||||
|
||||
return $extend(...$parameters);
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||
namespace Pest\Concerns;
|
||||
|
||||
use Closure;
|
||||
use Pest\Expectation;
|
||||
use Pest\Support\ExceptionTrace;
|
||||
use Pest\TestSuite;
|
||||
use PHPUnit\Util\Test;
|
||||
@ -94,16 +93,6 @@ trait TestCase
|
||||
parent::tearDownAfterClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function expect($value): Expectation
|
||||
{
|
||||
return new Expectation($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets executed before the test.
|
||||
*/
|
||||
|
||||
@ -18,14 +18,14 @@ final class Datasets
|
||||
/**
|
||||
* Holds the datasets.
|
||||
*
|
||||
* @var array<string, \Closure|iterable<int, mixed>>
|
||||
* @var array<int|string, Closure|iterable<int|string, mixed>>
|
||||
*/
|
||||
private static $datasets = [];
|
||||
|
||||
/**
|
||||
* Sets the given.
|
||||
*
|
||||
* @param Closure|iterable<int, mixed> $data
|
||||
* @param Closure|iterable<int|string, mixed> $data
|
||||
*/
|
||||
public static function set(string $name, $data): void
|
||||
{
|
||||
@ -37,7 +37,7 @@ final class Datasets
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Closure|iterable<int, mixed>
|
||||
* @return Closure|iterable<int|string, mixed>
|
||||
*/
|
||||
public static function get(string $name)
|
||||
{
|
||||
|
||||
@ -1,618 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest;
|
||||
|
||||
use Pest\Concerns\Extendable;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use PHPUnit\Framework\Constraint\Constraint;
|
||||
use SebastianBergmann\Exporter\Exporter;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @property Expectation $not Creates the opposite expectation.
|
||||
*/
|
||||
final class Expectation
|
||||
{
|
||||
use Extendable;
|
||||
|
||||
/**
|
||||
* The expectation value.
|
||||
*
|
||||
* @readonly
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* The exporter instance, if any.
|
||||
*
|
||||
* @readonly
|
||||
*
|
||||
* @var Exporter|null
|
||||
*/
|
||||
private $exporter;
|
||||
|
||||
/**
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function and($value): Expectation
|
||||
{
|
||||
return new self($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the opposite expectation for the value.
|
||||
*/
|
||||
public function not(): OppositeExpectation
|
||||
{
|
||||
return new OppositeExpectation($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two variables have the same type and
|
||||
* value. Used on objects, it asserts that two
|
||||
* variables reference the same object.
|
||||
*
|
||||
* @param mixed $expected
|
||||
*/
|
||||
public function toBe($expected): Expectation
|
||||
{
|
||||
Assert::assertSame($expected, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is empty.
|
||||
*/
|
||||
public function toBeEmpty(): Expectation
|
||||
{
|
||||
Assert::assertEmpty($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is true.
|
||||
*/
|
||||
public function toBeTrue(): Expectation
|
||||
{
|
||||
Assert::assertTrue($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is false.
|
||||
*/
|
||||
public function toBeFalse(): Expectation
|
||||
{
|
||||
Assert::assertFalse($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is greater than $expected.
|
||||
*
|
||||
* @param int|float $expected
|
||||
*/
|
||||
public function toBeGreaterThan($expected): Expectation
|
||||
{
|
||||
Assert::assertGreaterThan($expected, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is greater than or equal to $expected.
|
||||
*
|
||||
* @param int|float $expected
|
||||
*/
|
||||
public function toBeGreaterThanOrEqual($expected): Expectation
|
||||
{
|
||||
Assert::assertGreaterThanOrEqual($expected, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is less than or equal to $expected.
|
||||
*
|
||||
* @param int|float $expected
|
||||
*/
|
||||
public function toBeLessThan($expected): Expectation
|
||||
{
|
||||
Assert::assertLessThan($expected, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is less than $expected.
|
||||
*
|
||||
* @param int|float $expected
|
||||
*/
|
||||
public function toBeLessThanOrEqual($expected): Expectation
|
||||
{
|
||||
Assert::assertLessThanOrEqual($expected, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that $needle is an element of the value.
|
||||
*
|
||||
* @param mixed $needle
|
||||
*/
|
||||
public function toContain($needle): Expectation
|
||||
{
|
||||
if (is_string($this->value)) {
|
||||
Assert::assertStringContainsString($needle, $this->value);
|
||||
} else {
|
||||
Assert::assertContains($needle, $this->value);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value starts with $expected.
|
||||
*/
|
||||
public function toStartWith(string $expected): Expectation
|
||||
{
|
||||
Assert::assertStringStartsWith($expected, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value ends with $expected.
|
||||
*/
|
||||
public function toEndWith(string $expected): Expectation
|
||||
{
|
||||
Assert::assertStringEndsWith($expected, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that $count matches the number of elements of the value.
|
||||
*/
|
||||
public function toHaveCount(int $count): Expectation
|
||||
{
|
||||
Assert::assertCount($count, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value contains the property $name.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function toHaveProperty(string $name, $value = null): Expectation
|
||||
{
|
||||
$this->toBeObject();
|
||||
|
||||
Assert::assertTrue(property_exists($this->value, $name));
|
||||
|
||||
if (func_num_args() > 1) {
|
||||
/* @phpstan-ignore-next-line */
|
||||
Assert::assertEquals($value, $this->value->{$name});
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two variables have the same value.
|
||||
*
|
||||
* @param mixed $expected
|
||||
*/
|
||||
public function toEqual($expected): Expectation
|
||||
{
|
||||
Assert::assertEquals($expected, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two variables have the same value.
|
||||
* The contents of $expected and the $this->value are
|
||||
* canonicalized before they are compared. For instance, when the two
|
||||
* variables $expected and $this->value are arrays, then these arrays
|
||||
* are sorted before they are compared. When $expected and $this->value
|
||||
* are objects, each object is converted to an array containing all
|
||||
* private, protected and public attributes.
|
||||
*
|
||||
* @param mixed $expected
|
||||
*/
|
||||
public function toEqualCanonicalizing($expected): Expectation
|
||||
{
|
||||
Assert::assertEqualsCanonicalizing($expected, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the absolute difference between the value and $expected
|
||||
* is lower than $delta.
|
||||
*
|
||||
* @param mixed $expected
|
||||
*/
|
||||
public function toEqualWithDelta($expected, float $delta): Expectation
|
||||
{
|
||||
Assert::assertEqualsWithDelta($expected, $this->value, $delta);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is infinite.
|
||||
*/
|
||||
public function toBeInfinite(): Expectation
|
||||
{
|
||||
Assert::assertInfinite($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is an instance of $class.
|
||||
*
|
||||
* @param string $class
|
||||
*/
|
||||
public function toBeInstanceOf($class): Expectation
|
||||
{
|
||||
/* @phpstan-ignore-next-line */
|
||||
Assert::assertInstanceOf($class, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is an array.
|
||||
*/
|
||||
public function toBeArray(): Expectation
|
||||
{
|
||||
Assert::assertIsArray($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is of type bool.
|
||||
*/
|
||||
public function toBeBool(): Expectation
|
||||
{
|
||||
Assert::assertIsBool($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is of type callable.
|
||||
*/
|
||||
public function toBeCallable(): Expectation
|
||||
{
|
||||
Assert::assertIsCallable($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is of type float.
|
||||
*/
|
||||
public function toBeFloat(): Expectation
|
||||
{
|
||||
Assert::assertIsFloat($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is of type int.
|
||||
*/
|
||||
public function toBeInt(): Expectation
|
||||
{
|
||||
Assert::assertIsInt($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is of type iterable.
|
||||
*/
|
||||
public function toBeIterable(): Expectation
|
||||
{
|
||||
Assert::assertIsIterable($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is of type numeric.
|
||||
*/
|
||||
public function toBeNumeric(): Expectation
|
||||
{
|
||||
Assert::assertIsNumeric($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is of type object.
|
||||
*/
|
||||
public function toBeObject(): Expectation
|
||||
{
|
||||
Assert::assertIsObject($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is of type resource.
|
||||
*/
|
||||
public function toBeResource(): Expectation
|
||||
{
|
||||
Assert::assertIsResource($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is of type scalar.
|
||||
*/
|
||||
public function toBeScalar(): Expectation
|
||||
{
|
||||
Assert::assertIsScalar($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is of type string.
|
||||
*/
|
||||
public function toBeString(): Expectation
|
||||
{
|
||||
Assert::assertIsString($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is NAN.
|
||||
*/
|
||||
public function toBeNan(): Expectation
|
||||
{
|
||||
Assert::assertNan($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is null.
|
||||
*/
|
||||
public function toBeNull(): Expectation
|
||||
{
|
||||
Assert::assertNull($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value array has the provided $key.
|
||||
*
|
||||
* @param string|int $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function toHaveKey($key, $value = null): Expectation
|
||||
{
|
||||
if (is_object($this->value) && method_exists($this->value, 'toArray')) {
|
||||
$array = $this->value->toArray();
|
||||
} else {
|
||||
$array = (array) $this->value;
|
||||
}
|
||||
|
||||
Assert::assertArrayHasKey($key, $array);
|
||||
|
||||
if (func_num_args() > 1) {
|
||||
Assert::assertEquals($value, $array[$key]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value array has the provided $keys.
|
||||
*
|
||||
* @param array<int, int|string> $keys
|
||||
*/
|
||||
public function toHaveKeys(array $keys): Expectation
|
||||
{
|
||||
foreach ($keys as $key) {
|
||||
$this->toHaveKey($key);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is a directory.
|
||||
*/
|
||||
public function toBeDirectory(): Expectation
|
||||
{
|
||||
Assert::assertDirectoryExists($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is a directory and is readable.
|
||||
*/
|
||||
public function toBeReadableDirectory(): Expectation
|
||||
{
|
||||
Assert::assertDirectoryIsReadable($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is a directory and is writable.
|
||||
*/
|
||||
public function toBeWritableDirectory(): Expectation
|
||||
{
|
||||
Assert::assertDirectoryIsWritable($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is a file.
|
||||
*/
|
||||
public function toBeFile(): Expectation
|
||||
{
|
||||
Assert::assertFileExists($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is a file and is readable.
|
||||
*/
|
||||
public function toBeReadableFile(): Expectation
|
||||
{
|
||||
Assert::assertFileIsReadable($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value is a file and is writable.
|
||||
*/
|
||||
public function toBeWritableFile(): Expectation
|
||||
{
|
||||
Assert::assertFileIsWritable($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value array matches the given array subset.
|
||||
*
|
||||
* @param array<int|string, mixed> $array
|
||||
*/
|
||||
public function toMatchArray($array): Expectation
|
||||
{
|
||||
if (is_object($this->value) && method_exists($this->value, 'toArray')) {
|
||||
$valueAsArray = $this->value->toArray();
|
||||
} else {
|
||||
$valueAsArray = (array) $this->value;
|
||||
}
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
Assert::assertArrayHasKey($key, $valueAsArray);
|
||||
|
||||
Assert::assertEquals(
|
||||
$value,
|
||||
$valueAsArray[$key],
|
||||
sprintf(
|
||||
'Failed asserting that an array has a key %s with the value %s.',
|
||||
$this->export($key),
|
||||
$this->export($valueAsArray[$key]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value object matches a subset
|
||||
* of the properties of an given object.
|
||||
*
|
||||
* @param array<string, mixed>|object $object
|
||||
*/
|
||||
public function toMatchObject($object): Expectation
|
||||
{
|
||||
foreach ((array) $object as $property => $value) {
|
||||
Assert::assertTrue(property_exists($this->value, $property));
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
$propertyValue = $this->value->{$property};
|
||||
Assert::assertEquals(
|
||||
$value,
|
||||
$propertyValue,
|
||||
sprintf(
|
||||
'Failed asserting that an object has a property %s with the value %s.',
|
||||
$this->export($property),
|
||||
$this->export($propertyValue),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value matches a regular expression.
|
||||
*/
|
||||
public function toMatch(string $expression): Expectation
|
||||
{
|
||||
Assert::assertMatchesRegularExpression($expression, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value matches a constraint.
|
||||
*/
|
||||
public function toMatchConstraint(Constraint $constraint): Expectation
|
||||
{
|
||||
Assert::assertThat($this->value, $constraint);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the given value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
private function export($value): string
|
||||
{
|
||||
if ($this->exporter === null) {
|
||||
$this->exporter = new Exporter();
|
||||
}
|
||||
|
||||
return $this->exporter->export($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically calls methods on the class without any arguments.
|
||||
*
|
||||
* @return Expectation
|
||||
*/
|
||||
public function __get(string $name)
|
||||
{
|
||||
/* @phpstan-ignore-next-line */
|
||||
return $this->{$name}();
|
||||
}
|
||||
}
|
||||
@ -3,13 +3,11 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
use Pest\Datasets;
|
||||
use Pest\Expectation;
|
||||
use Pest\PendingObjects\AfterEachCall;
|
||||
use Pest\PendingObjects\BeforeEachCall;
|
||||
use Pest\PendingObjects\TestCall;
|
||||
use Pest\PendingObjects\UsesCall;
|
||||
use Pest\Support\Backtrace;
|
||||
use Pest\Support\Extendable;
|
||||
use Pest\Support\HigherOrderTapProxy;
|
||||
use Pest\TestSuite;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@ -37,7 +35,7 @@ function beforeEach(Closure $closure = null): BeforeEachCall
|
||||
/**
|
||||
* Registers the given dataset.
|
||||
*
|
||||
* @param Closure|iterable $dataset
|
||||
* @param Closure|iterable<int|string, mixed> $dataset
|
||||
*/
|
||||
function dataset(string $name, $dataset): void
|
||||
{
|
||||
@ -64,7 +62,7 @@ function uses(string ...$classAndTraits): UsesCall
|
||||
*/
|
||||
function test(string $description = null, Closure $closure = null)
|
||||
{
|
||||
if ($description === null && TestSuite::getInstance()->test) {
|
||||
if ($description === null && TestSuite::getInstance()->test !== null) {
|
||||
return new HigherOrderTapProxy(TestSuite::getInstance()->test);
|
||||
}
|
||||
|
||||
@ -102,23 +100,7 @@ function afterEach(Closure $closure = null): AfterEachCall
|
||||
/**
|
||||
* Runs the given closure after all tests in the current file.
|
||||
*/
|
||||
function afterAll(Closure $closure = null): void
|
||||
function afterAll(Closure $closure): void
|
||||
{
|
||||
TestSuite::getInstance()->afterAll->set($closure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value the Value
|
||||
*
|
||||
* @return Expectation|Extendable
|
||||
*/
|
||||
function expect($value = null)
|
||||
{
|
||||
if (func_num_args() === 0) {
|
||||
return new Extendable(Expectation::class);
|
||||
}
|
||||
|
||||
return test()->expect($value);
|
||||
}
|
||||
@ -1,100 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest;
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
use SebastianBergmann\Exporter\Exporter;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @mixin Expectation
|
||||
*/
|
||||
final class OppositeExpectation
|
||||
{
|
||||
/**
|
||||
* @var Expectation
|
||||
*/
|
||||
private $original;
|
||||
|
||||
/**
|
||||
* Creates a new opposite expectation.
|
||||
*/
|
||||
public function __construct(Expectation $original)
|
||||
{
|
||||
$this->original = $original;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the value array not has the provided $keys.
|
||||
*
|
||||
* @param array<int, int|string> $keys
|
||||
*/
|
||||
public function toHaveKeys(array $keys): Expectation
|
||||
{
|
||||
foreach ($keys as $key) {
|
||||
try {
|
||||
$this->original->toHaveKey($key);
|
||||
} catch (ExpectationFailedException $e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->throwExpectationFailedExpection('toHaveKey', [$key]);
|
||||
}
|
||||
|
||||
return $this->original;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dynamic method calls into the original expectation.
|
||||
*
|
||||
* @param array<int, mixed> $arguments
|
||||
*/
|
||||
public function __call(string $name, array $arguments): Expectation
|
||||
{
|
||||
try {
|
||||
/* @phpstan-ignore-next-line */
|
||||
$this->original->{$name}(...$arguments);
|
||||
} catch (ExpectationFailedException $e) {
|
||||
return $this->original;
|
||||
}
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
$this->throwExpectationFailedExpection($name, $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dynamic properties gets into the original expectation.
|
||||
*/
|
||||
public function __get(string $name): Expectation
|
||||
{
|
||||
try {
|
||||
/* @phpstan-ignore-next-line */
|
||||
$this->original->{$name};
|
||||
} catch (ExpectationFailedException $e) {
|
||||
return $this->original;
|
||||
}
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
$this->throwExpectationFailedExpection($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new expectation failed exception
|
||||
* with a nice readable message.
|
||||
*
|
||||
* @param array<int, mixed> $arguments
|
||||
*/
|
||||
private function throwExpectationFailedExpection(string $name, array $arguments = []): void
|
||||
{
|
||||
$exporter = new Exporter();
|
||||
|
||||
$toString = function ($argument) use ($exporter): string {
|
||||
return $exporter->shortenedExport($argument);
|
||||
};
|
||||
|
||||
throw new ExpectationFailedException(sprintf('Expecting %s not %s %s.', $toString($this->original->value), strtolower((string) preg_replace('/(?<!\ )[A-Z]/', ' $0', $name)), implode(' ', array_map(function ($argument) use ($toString): string { return $toString($argument); }, $arguments))));
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest\Support;
|
||||
|
||||
use Closure;
|
||||
|
||||
final class Extendable
|
||||
{
|
||||
/**
|
||||
* The extendable class.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $extendableClass;
|
||||
|
||||
/**
|
||||
* Creates a new extendable instance.
|
||||
*/
|
||||
public function __construct(string $extendableClass)
|
||||
{
|
||||
$this->extendableClass = $extendableClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom extend.
|
||||
*/
|
||||
public function extend(string $name, Closure $extend): void
|
||||
{
|
||||
$this->extendableClass::extend($name, $extend);
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,7 @@ final class TeamCity extends DefaultResultPrinter
|
||||
/** @phpstan-ignore-next-line */
|
||||
public function startTestSuite(TestSuite $suite): void
|
||||
{
|
||||
$this->flowId = getmypid();
|
||||
$this->flowId = (int) getmypid();
|
||||
|
||||
if (!$this->isSummaryTestCountPrinted) {
|
||||
$this->printEvent(
|
||||
|
||||
@ -2,232 +2,6 @@
|
||||
PASS Tests\CustomTestCase\ExecutedTest
|
||||
✓ that gets executed
|
||||
|
||||
PASS Tests\Expect\extend
|
||||
✓ it macros true is true
|
||||
✓ it macros false is not true
|
||||
✓ it macros true is true with argument
|
||||
✓ it macros false is not true with argument
|
||||
|
||||
PASS Tests\Expect\not
|
||||
✓ not property calls
|
||||
|
||||
PASS Tests\Expect\toBe
|
||||
✓ expect true → toBeTrue → and false → toBeFalse
|
||||
✓ strict comparisons
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeArray
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeBool
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeCallable
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeDirectory
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeEmpty
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeFalse
|
||||
✓ strict comparisons
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeFile
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeFloat
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeGreatherThan
|
||||
✓ passes
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeGreatherThanOrEqual
|
||||
✓ passes
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeInfinite
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeInstanceOf
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeInt
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeIterable
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeLessThan
|
||||
✓ passes
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeLessThanOrEqual
|
||||
✓ passes
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeNAN
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeNull
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeNumeric
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeObject
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeReadableDirectory
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeReadableFile
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeResource
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeScalar
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeString
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeTrue
|
||||
✓ strict comparisons
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeWritableDirectory
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toBeWritableFile
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toContain
|
||||
✓ passes strings
|
||||
✓ passes arrays
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toEndWith
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toEqual
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toEqualCanonicalizing
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toEqualWithDelta
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toHaveCount
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toHaveKey
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toHaveKeys
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toHaveProperty
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toMatch
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toMatchArray
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toMatchConstraint
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toMatchObject
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Expect\toStartWith
|
||||
✓ pass
|
||||
✓ failures
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Features\AfterAll
|
||||
✓ deletes file after all
|
||||
|
||||
@ -410,5 +184,5 @@
|
||||
✓ depends run test only once
|
||||
✓ depends works with the correct test name
|
||||
|
||||
Tests: 7 skipped, 242 passed
|
||||
Tests: 7 skipped, 106 passed
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
expect()->extend('toBeAMacroExpectation', function () {
|
||||
$this->toBeTrue();
|
||||
|
||||
return $this;
|
||||
});
|
||||
|
||||
expect()->extend('toBeAMacroExpectationWithArguments', function (bool $value) {
|
||||
$this->toBe($value);
|
||||
|
||||
return $this;
|
||||
});
|
||||
|
||||
it('macros true is true', function () {
|
||||
expect(true)->toBeAMacroExpectation();
|
||||
});
|
||||
|
||||
it('macros false is not true', function () {
|
||||
expect(false)->not->toBeAMacroExpectation();
|
||||
});
|
||||
|
||||
it('macros true is true with argument', function () {
|
||||
expect(true)->toBeAMacroExpectationWithArguments(true);
|
||||
});
|
||||
|
||||
it('macros false is not true with argument', function () {
|
||||
expect(false)->not->toBeAMacroExpectationWithArguments(true);
|
||||
});
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
test('not property calls', function () {
|
||||
expect(true)
|
||||
->toBeTrue()
|
||||
->not()->toBeFalse()
|
||||
->not->toBeFalse
|
||||
->and(false)
|
||||
->toBeFalse();
|
||||
});
|
||||
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
expect(true)->toBeTrue()->and(false)->toBeFalse();
|
||||
|
||||
test('strict comparisons', function () {
|
||||
$nuno = new stdClass();
|
||||
$dries = new stdClass();
|
||||
|
||||
expect($nuno)->toBe($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);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect([1, 2, 3])->toBeArray();
|
||||
expect('1, 2, 3')->not->toBeArray();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(null)->toBeArray();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(['a', 'b', 'c'])->not->toBeArray();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(true)->toBeBool();
|
||||
expect(0)->not->toBeBool();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(null)->toBeBool();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(false)->not->toBeBool();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(function () {})->toBeCallable();
|
||||
expect(null)->not->toBeCallable();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
$hello = 5;
|
||||
|
||||
expect($hello)->toBeCallable();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(function () { return 42; })->not->toBeCallable();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
$temp = sys_get_temp_dir();
|
||||
|
||||
expect($temp)->toBeDirectory();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('/random/path/whatever')->toBeDirectory();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect('.')->not->toBeDirectory();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect([])->toBeEmpty();
|
||||
expect(null)->toBeEmpty();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect([1, 2])->toBeEmpty();
|
||||
expect(' ')->toBeEmpty();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect([])->not->toBeEmpty();
|
||||
expect(null)->not->toBeEmpty();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('strict comparisons', function () {
|
||||
expect(false)->toBeFalse();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('')->toBeFalse();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(false)->not->toBe(false);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
beforeEach(function () {
|
||||
touch($this->tempFile = sys_get_temp_dir() . '/fake.file');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
unlink($this->tempFile);
|
||||
});
|
||||
|
||||
test('pass', function () {
|
||||
expect($this->tempFile)->toBeFile();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('/random/path/whatever.file')->toBeFile();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect($this->tempFile)->not->toBeFile();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(1.0)->toBeFloat();
|
||||
expect(1)->not->toBeFloat();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(42)->toBeFloat();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(log(3))->not->toBeFloat();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('passes', function () {
|
||||
expect(42)->toBeGreaterThan(41);
|
||||
expect(4)->toBeGreaterThan(3.9);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(4)->toBeGreaterThan(4);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(5)->not->toBeGreaterThan(4);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('passes', function () {
|
||||
expect(42)->toBeGreaterThanOrEqual(41);
|
||||
expect(4)->toBeGreaterThanOrEqual(4);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(4)->toBeGreaterThanOrEqual(4.1);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(5)->not->toBeGreaterThanOrEqual(5);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(log(0))->toBeInfinite();
|
||||
expect(log(1))->not->toBeInfinite();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(asin(2))->toBeInfinite();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(INF)->not->toBeInfinite();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(new Exception())->toBeInstanceOf(Exception::class);
|
||||
expect(new Exception())->not->toBeInstanceOf(RuntimeException::class);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(new Exception())->toBeInstanceOf(RuntimeException::class);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(new Exception())->not->toBeInstanceOf(Exception::class);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(42)->toBeInt();
|
||||
expect(42.0)->not->toBeInt();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(42.0)->toBeInt();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(6 * 7)->not->toBeInt();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect([])->toBeIterable();
|
||||
expect(null)->not->toBeIterable();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(42)->toBeIterable();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
function gen(): iterable
|
||||
{
|
||||
yield 1;
|
||||
yield 2;
|
||||
yield 3;
|
||||
}
|
||||
|
||||
expect(gen())->not->toBeIterable();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('passes', function () {
|
||||
expect(41)->toBeLessThan(42);
|
||||
expect(4)->toBeLessThan(5);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(4)->toBeLessThan(4);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(5)->not->toBeLessThan(6);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('passes', function () {
|
||||
expect(41)->toBeLessThanOrEqual(42);
|
||||
expect(4)->toBeLessThanOrEqual(4);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(4)->toBeLessThanOrEqual(3.9);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(5)->not->toBeLessThanOrEqual(5);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(asin(2))->toBeNan();
|
||||
expect(log(0))->not->toBeNan();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(1)->toBeNan();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(acos(1.5))->not->toBeNan();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(null)->toBeNull();
|
||||
expect('')->not->toBeNull();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('hello')->toBeNull();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(null)->not->toBeNull();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(42)->toBeNumeric();
|
||||
expect('A')->not->toBeNumeric();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(null)->toBeNumeric();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(6 * 7)->not->toBeNumeric();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect((object) ['a' => 1])->toBeObject();
|
||||
expect(['a' => 1])->not->toBeObject();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(null)->toBeObject();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect((object) 'ciao')->not->toBeObject();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(sys_get_temp_dir())->toBeReadableDirectory();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('/random/path/whatever')->toBeReadableDirectory();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(sys_get_temp_dir())->not->toBeReadableDirectory();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
beforeEach(function () {
|
||||
touch($this->tempFile = sys_get_temp_dir() . '/fake.file');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
unlink($this->tempFile);
|
||||
});
|
||||
|
||||
test('pass', function () {
|
||||
expect($this->tempFile)->toBeReadableFile();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('/random/path/whatever.file')->toBeReadableFile();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect($this->tempFile)->not->toBeReadableFile();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
$resource = tmpfile();
|
||||
|
||||
afterAll(function () use ($resource) {
|
||||
fclose($resource);
|
||||
});
|
||||
|
||||
test('pass', function () use ($resource) {
|
||||
expect($resource)->toBeResource();
|
||||
expect(null)->not->toBeResource();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(null)->toBeResource();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () use ($resource) {
|
||||
expect($resource)->not->toBeResource();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(1.1)->toBeScalar();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(null)->toBeScalar();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(42)->not->toBeScalar();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect('1.1')->toBeString();
|
||||
expect(1.1)->not->toBeString();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(null)->toBeString();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect('42')->not->toBeString();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('strict comparisons', function () {
|
||||
expect(true)->toBeTrue();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('')->toBeTrue();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(false)->not->toBe(false);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(sys_get_temp_dir())->toBeWritableDirectory();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('/random/path/whatever')->toBeWritableDirectory();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(sys_get_temp_dir())->not->toBeWritableDirectory();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
beforeEach(function () {
|
||||
touch($this->tempFile = sys_get_temp_dir() . '/fake.file');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
unlink($this->tempFile);
|
||||
});
|
||||
|
||||
test('pass', function () {
|
||||
expect($this->tempFile)->toBeWritableFile();
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('/random/path/whatever.file')->toBeWritableFile();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect($this->tempFile)->not->toBeWritableFile();
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('passes strings', function () {
|
||||
expect([1, 2, 42])->toContain(42);
|
||||
});
|
||||
|
||||
test('passes arrays', function () {
|
||||
expect('Nuno')->toContain('Nu');
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect([1, 2, 42])->toContain(3);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect([1, 2, 42])->not->toContain(42);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect('username')->toEndWith('name');
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('username')->toEndWith('password');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect('username')->not->toEndWith('name');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect('00123')->toEqual(123);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(['a', 'b', 'c'])->toEqual(['a', 'b']);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect('042')->not->toEqual(42);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect([1, 2, 3])->toEqualCanonicalizing([3, 1, 2]);
|
||||
expect(['g', 'a', 'z'])->not->toEqualCanonicalizing(['a', 'z']);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect([3, 2, 1])->toEqualCanonicalizing([1, 2]);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(['a', 'b', 'c'])->not->toEqualCanonicalizing(['b', 'a', 'c']);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(1.0)->toEqualWithDelta(1.3, .4);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(1.0)->toEqualWithDelta(1.5, .1);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(1.0)->not->toEqualWithDelta(1.6, .7);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect([1, 2, 3])->toHaveCount(3);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect([1, 2, 3])->toHaveCount(4);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect([1, 2, 3])->not->toHaveCount(3);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(['a' => 1, 'b', 'c' => 'world'])->toHaveKey('c');
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(['a' => 1, 'b', 'c' => 'world'])->toHaveKey('hello');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(['a' => 1, 'hello' => 'world', 'c'])->not->toHaveKey('hello');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(['a' => 1, 'b', 'c' => 'world'])->toHaveKeys(['a', 'c']);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(['a' => 1, 'b', 'c' => 'world'])->toHaveKeys(['a', 'd']);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(['a' => 1, 'hello' => 'world', 'c'])->not->toHaveKeys(['hello', 'c']);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->foo = 'bar';
|
||||
$obj->fooNull = null;
|
||||
|
||||
test('pass', function () use ($obj) {
|
||||
expect($obj)->toHaveProperty('foo');
|
||||
expect($obj)->toHaveProperty('foo', 'bar');
|
||||
expect($obj)->toHaveProperty('fooNull');
|
||||
expect($obj)->toHaveProperty('fooNull', null);
|
||||
});
|
||||
|
||||
test('failures', function () use ($obj) {
|
||||
expect($obj)->toHaveProperty('bar');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () use ($obj) {
|
||||
expect($obj)->not->toHaveProperty('foo');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect('Hello World')->toMatch('/^hello wo.*$/i');
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('Hello World')->toMatch('/^hello$/i');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect('Hello World')->not->toMatch('/^hello wo.*$/i');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
beforeEach(function () {
|
||||
$this->user = [
|
||||
'id' => 1,
|
||||
'name' => 'Nuno',
|
||||
'email' => 'enunomaduro@gmail.com',
|
||||
];
|
||||
});
|
||||
|
||||
test('pass', function () {
|
||||
expect($this->user)->toMatchArray([
|
||||
'name' => 'Nuno',
|
||||
'email' => 'enunomaduro@gmail.com',
|
||||
]);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect($this->user)->toMatchArray([
|
||||
'name' => 'Not the same name',
|
||||
'email' => 'enunomaduro@gmail.com',
|
||||
]);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect($this->user)->not->toMatchArray([
|
||||
'id' => 1,
|
||||
]);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\Constraint\IsTrue;
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect(true)->toMatchConstraint(new IsTrue());
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(false)->toMatchConstraint(new IsTrue());
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect(true)->not->toMatchConstraint(new IsTrue());
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
beforeEach(function () {
|
||||
$this->user = (object) [
|
||||
'id' => 1,
|
||||
'name' => 'Nuno',
|
||||
'email' => 'enunomaduro@gmail.com',
|
||||
];
|
||||
});
|
||||
|
||||
test('pass', function () {
|
||||
expect($this->user)->toMatchObject([
|
||||
'name' => 'Nuno',
|
||||
'email' => 'enunomaduro@gmail.com',
|
||||
]);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect($this->user)->toMatchObject([
|
||||
'name' => 'Not the same name',
|
||||
'email' => 'enunomaduro@gmail.com',
|
||||
]);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect($this->user)->not->toMatchObject([
|
||||
'id' => 1,
|
||||
]);
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
test('pass', function () {
|
||||
expect('username')->toStartWith('user');
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect('username')->toStartWith('password');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
|
||||
test('not failures', function () {
|
||||
expect('username')->not->toStartWith('user');
|
||||
})->throws(ExpectationFailedException::class);
|
||||
@ -6,7 +6,7 @@ beforeEach(function () use ($state) {
|
||||
$this->state = $state;
|
||||
});
|
||||
|
||||
afterEach(function () use ($state) {
|
||||
afterEach(function () {
|
||||
$this->state->bar = 2;
|
||||
});
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ $namedDatasets = [
|
||||
new Bar(),
|
||||
];
|
||||
|
||||
test('lazy named datasets', function ($text) use ($state, $datasets) {
|
||||
test('lazy named datasets', function ($text) {
|
||||
expect(true)->toBeTrue();
|
||||
})->with($namedDatasets);
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ test('default php unit tests', function () {
|
||||
expect($testSuite->tests())->toHaveCount(1);
|
||||
});
|
||||
|
||||
it('removes warnings', function () use ($pestTestCase) {
|
||||
it('removes warnings', function () {
|
||||
$testSuite = new TestSuite();
|
||||
$warningTestCase = new WarningTestCase('No tests found in class "Pest\TestCase".');
|
||||
$testSuite->addTest($warningTestCase);
|
||||
|
||||
Reference in New Issue
Block a user