mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 17:57:23 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 66f69617f1 | |||
| 5721e8c29a | |||
| 546d19fd84 | |||
| c1b32b9ffb | |||
| 298b1e6784 |
@ -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/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## [v1.21.3 (2022-05-12)](https://github.com/pestphp/pest/compare/v1.21.2...v1.21.3)
|
||||||
|
### Fixed
|
||||||
|
- Debug of high order tests ([c1b32b9](https://github.com/pestphp/pest/commit/c1b32b9ffb5134803c490592454b11b8c05ea27d))
|
||||||
|
|
||||||
## [v1.21.2 (2022-03-05)](https://github.com/pestphp/pest/compare/v1.21.1...v1.21.2)
|
## [v1.21.2 (2022-03-05)](https://github.com/pestphp/pest/compare/v1.21.1...v1.21.2)
|
||||||
### Fixed
|
### Fixed
|
||||||
- `toThrow` expectation when exception does not exist ([#487](https://github.com/pestphp/pest/pull/487))
|
- `toThrow` expectation when exception does not exist ([#487](https://github.com/pestphp/pest/pull/487))
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
When releasing a new version of Pest there are some checks and updates that need to be done:
|
When releasing a new version of Pest there are some checks and updates that need to be done:
|
||||||
|
|
||||||
- Clear your local repository with: `git add . && git reset --hard && git checkout master`
|
- Clear your local repository with: `git add . && git reset --hard && git checkout 1.x`
|
||||||
- On the GitHub repository, check the contents of [github.com/pestphp/pest/compare/{latest_version}...master](https://github.com/pestphp/pest/compare/{latest_version}...master) and update the [changelog](CHANGELOG.md) file with the main changes for this release
|
- On the GitHub repository, check the contents of [github.com/pestphp/pest/compare/{latest_version}...1.x](https://github.com/pestphp/pest/compare/{latest_version}...1.x) and update the [changelog](CHANGELOG.md) file with the main changes for this release
|
||||||
- Update the version number in [src/Pest.php](src/Pest.php)
|
- Update the version number in [src/Pest.php](src/Pest.php)
|
||||||
- Run the tests locally using: `composer test`
|
- Run the tests locally using: `composer test`
|
||||||
- Commit the CHANGELOG and Pest file with the message: `git commit -m "release: vX.X.X"`
|
- Commit the CHANGELOG and Pest file with the message: `git commit -m "release: vX.X.X"`
|
||||||
|
|||||||
@ -76,7 +76,7 @@
|
|||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.x-dev"
|
"dev-1.x": "1.x-dev"
|
||||||
},
|
},
|
||||||
"pest": {
|
"pest": {
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
|||||||
@ -723,7 +723,7 @@ final class Expectation
|
|||||||
try {
|
try {
|
||||||
Assert::assertTrue(Arr::has($array, $key));
|
Assert::assertTrue(Arr::has($array, $key));
|
||||||
|
|
||||||
/* @phpstan-ignore-next-line */
|
/* @phpstan-ignore-next-line */
|
||||||
} catch (ExpectationFailedException $exception) {
|
} catch (ExpectationFailedException $exception) {
|
||||||
throw new ExpectationFailedException("Failed asserting that an array has the key '$key'", $exception->getComparisonFailure());
|
throw new ExpectationFailedException("Failed asserting that an array has the key '$key'", $exception->getComparisonFailure());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,7 +183,7 @@ final class TestCall
|
|||||||
*/
|
*/
|
||||||
public function __get(string $name): self
|
public function __get(string $name): self
|
||||||
{
|
{
|
||||||
return $this->addChain($name);
|
return $this->addChain(Backtrace::file(), Backtrace::line(), $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -193,7 +193,7 @@ final class TestCall
|
|||||||
*/
|
*/
|
||||||
public function __call(string $name, array $arguments): self
|
public function __call(string $name, array $arguments): self
|
||||||
{
|
{
|
||||||
return $this->addChain($name, $arguments);
|
return $this->addChain(Backtrace::file(), Backtrace::line(), $name, $arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,11 +201,11 @@ final class TestCall
|
|||||||
*
|
*
|
||||||
* @param array<int, mixed>|null $arguments
|
* @param array<int, mixed>|null $arguments
|
||||||
*/
|
*/
|
||||||
private function addChain(string $name, array $arguments = null): self
|
private function addChain(string $file, int $line, string $name, array $arguments = null): self
|
||||||
{
|
{
|
||||||
$this->testCaseFactory
|
$this->testCaseFactory
|
||||||
->chains
|
->chains
|
||||||
->add(Backtrace::file(), Backtrace::line(), $name, $arguments);
|
->add($file, $line, $name, $arguments);
|
||||||
|
|
||||||
if ($this->descriptionLess) {
|
if ($this->descriptionLess) {
|
||||||
$exporter = new Exporter();
|
$exporter = new Exporter();
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace Pest;
|
|||||||
|
|
||||||
function version(): string
|
function version(): string
|
||||||
{
|
{
|
||||||
return '1.21.2';
|
return '1.21.3';
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDirectory(string $file = ''): string
|
function testDirectory(string $file = ''): string
|
||||||
|
|||||||
@ -8,7 +8,7 @@ use Symfony\Component\Console\Output\ConsoleOutput;
|
|||||||
it('has plugin')->assertTrue(class_exists(CoveragePlugin::class));
|
it('has plugin')->assertTrue(class_exists(CoveragePlugin::class));
|
||||||
|
|
||||||
it('adds coverage if --coverage exist', function () {
|
it('adds coverage if --coverage exist', function () {
|
||||||
$plugin = new CoveragePlugin(new ConsoleOutput());
|
$plugin = new CoveragePlugin(new ConsoleOutput());
|
||||||
$testSuite = TestSuite::getInstance();
|
$testSuite = TestSuite::getInstance();
|
||||||
|
|
||||||
expect($plugin->coverage)->toBeFalse();
|
expect($plugin->coverage)->toBeFalse();
|
||||||
|
|||||||
@ -5,7 +5,7 @@ use PHPUnit\Framework\ExpectationFailedException;
|
|||||||
expect(true)->toBeTrue()->and(false)->toBeFalse();
|
expect(true)->toBeTrue()->and(false)->toBeFalse();
|
||||||
|
|
||||||
test('strict comparisons', function () {
|
test('strict comparisons', function () {
|
||||||
$nuno = new stdClass();
|
$nuno = new stdClass();
|
||||||
$dries = new stdClass();
|
$dries = new stdClass();
|
||||||
|
|
||||||
expect($nuno)->toBe($nuno)->not->toBe($dries);
|
expect($nuno)->toBe($nuno)->not->toBe($dries);
|
||||||
|
|||||||
@ -3,24 +3,24 @@
|
|||||||
use PHPUnit\Framework\ExpectationFailedException;
|
use PHPUnit\Framework\ExpectationFailedException;
|
||||||
|
|
||||||
test('pass', function () {
|
test('pass', function () {
|
||||||
$object = new stdClass();
|
$object = new stdClass();
|
||||||
$object->name = 'Jhon';
|
$object->name = 'Jhon';
|
||||||
$object->age = 21;
|
$object->age = 21;
|
||||||
|
|
||||||
expect($object)->toHaveProperties(['name', 'age']);
|
expect($object)->toHaveProperties(['name', 'age']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('failures', function () {
|
test('failures', function () {
|
||||||
$object = new stdClass();
|
$object = new stdClass();
|
||||||
$object->name = 'Jhon';
|
$object->name = 'Jhon';
|
||||||
|
|
||||||
expect($object)->toHaveProperties(['name', 'age']);
|
expect($object)->toHaveProperties(['name', 'age']);
|
||||||
})->throws(ExpectationFailedException::class);
|
})->throws(ExpectationFailedException::class);
|
||||||
|
|
||||||
test('not failures', function () {
|
test('not failures', function () {
|
||||||
$object = new stdClass();
|
$object = new stdClass();
|
||||||
$object->name = 'Jhon';
|
$object->name = 'Jhon';
|
||||||
$object->age = 21;
|
$object->age = 21;
|
||||||
|
|
||||||
expect($object)->not->toHaveProperties(['name', 'age']);
|
expect($object)->not->toHaveProperties(['name', 'age']);
|
||||||
})->throws(ExpectationFailedException::class);
|
})->throws(ExpectationFailedException::class);
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
use PHPUnit\Framework\ExpectationFailedException;
|
use PHPUnit\Framework\ExpectationFailedException;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
$this->unlessObject = new stdClass();
|
$this->unlessObject = new stdClass();
|
||||||
$this->unlessObject->trueValue = true;
|
$this->unlessObject->trueValue = true;
|
||||||
$this->unlessObject->foo = 'foo';
|
$this->unlessObject->foo = 'foo';
|
||||||
});
|
});
|
||||||
|
|
||||||
it('pass', function () {
|
it('pass', function () {
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
use PHPUnit\Framework\ExpectationFailedException;
|
use PHPUnit\Framework\ExpectationFailedException;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
$this->whenObject = new stdClass();
|
$this->whenObject = new stdClass();
|
||||||
$this->whenObject->trueValue = true;
|
$this->whenObject->trueValue = true;
|
||||||
$this->whenObject->foo = 'foo';
|
$this->whenObject->foo = 'foo';
|
||||||
});
|
});
|
||||||
|
|
||||||
it('pass', function () {
|
it('pass', function () {
|
||||||
|
|||||||
@ -23,7 +23,7 @@ test('default php unit tests', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('removes warnings', function () {
|
it('removes warnings', function () {
|
||||||
$testSuite = new TestSuite();
|
$testSuite = new TestSuite();
|
||||||
$warningTestCase = new WarningTestCase('No tests found in class "Pest\TestCase".');
|
$warningTestCase = new WarningTestCase('No tests found in class "Pest\TestCase".');
|
||||||
$testSuite->addTest($warningTestCase);
|
$testSuite->addTest($warningTestCase);
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ it('gets file name from closure', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('gets property values', function () {
|
it('gets property values', function () {
|
||||||
$class = new class() {
|
$class = new class() {
|
||||||
private $foo = 'bar';
|
private $foo = 'bar';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ use Pest\TestSuite;
|
|||||||
|
|
||||||
it('does not allow to add the same test description twice', function () {
|
it('does not allow to add the same test description twice', function () {
|
||||||
$testSuite = new TestSuite(getcwd(), 'tests');
|
$testSuite = new TestSuite(getcwd(), 'tests');
|
||||||
$test = function () {};
|
$test = function () {};
|
||||||
$testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test));
|
$testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test));
|
||||||
$testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test));
|
$testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test));
|
||||||
})->throws(
|
})->throws(
|
||||||
@ -18,7 +18,7 @@ it('does not allow to add the same test description twice', function () {
|
|||||||
|
|
||||||
it('alerts users about tests with arguments but no input', function () {
|
it('alerts users about tests with arguments but no input', function () {
|
||||||
$testSuite = new TestSuite(getcwd(), 'tests');
|
$testSuite = new TestSuite(getcwd(), 'tests');
|
||||||
$test = function (int $arg) {};
|
$test = function (int $arg) {};
|
||||||
$testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test));
|
$testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test));
|
||||||
})->throws(
|
})->throws(
|
||||||
DatasetMissing::class,
|
DatasetMissing::class,
|
||||||
@ -27,7 +27,7 @@ it('alerts users about tests with arguments but no input', function () {
|
|||||||
|
|
||||||
it('can return an array of all test suite filenames', function () {
|
it('can return an array of all test suite filenames', function () {
|
||||||
$testSuite = TestSuite::getInstance(getcwd(), 'tests');
|
$testSuite = TestSuite::getInstance(getcwd(), 'tests');
|
||||||
$test = function () {};
|
$test = function () {};
|
||||||
$testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test));
|
$testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test));
|
||||||
$testSuite->tests->set(new TestCaseFactory(__FILE__, 'bar', $test));
|
$testSuite->tests->set(new TestCaseFactory(__FILE__, 'bar', $test));
|
||||||
|
|
||||||
@ -39,9 +39,9 @@ it('can return an array of all test suite filenames', function () {
|
|||||||
|
|
||||||
it('can filter the test suite filenames to those with the only method', function () {
|
it('can filter the test suite filenames to those with the only method', function () {
|
||||||
$testSuite = new TestSuite(getcwd(), 'tests');
|
$testSuite = new TestSuite(getcwd(), 'tests');
|
||||||
$test = function () {};
|
$test = function () {};
|
||||||
|
|
||||||
$testWithOnly = new TestCaseFactory(__FILE__, 'foo', $test);
|
$testWithOnly = new TestCaseFactory(__FILE__, 'foo', $test);
|
||||||
$testWithOnly->only = true;
|
$testWithOnly->only = true;
|
||||||
$testSuite->tests->set($testWithOnly);
|
$testSuite->tests->set($testWithOnly);
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ it('does not filter the test suite filenames to those with the only method when
|
|||||||
|
|
||||||
$test = function () {};
|
$test = function () {};
|
||||||
|
|
||||||
$testWithOnly = new TestCaseFactory(__FILE__, 'foo', $test);
|
$testWithOnly = new TestCaseFactory(__FILE__, 'foo', $test);
|
||||||
$testWithOnly->only = true;
|
$testWithOnly->only = true;
|
||||||
$testSuite->tests->set($testWithOnly);
|
$testSuite->tests->set($testWithOnly);
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ test('visual snapshot of help command output', function () {
|
|||||||
|
|
||||||
if (getenv('REBUILD_SNAPSHOTS')) {
|
if (getenv('REBUILD_SNAPSHOTS')) {
|
||||||
$outputBuffer = new BufferedOutput();
|
$outputBuffer = new BufferedOutput();
|
||||||
$plugin = new Help($outputBuffer);
|
$plugin = new Help($outputBuffer);
|
||||||
|
|
||||||
$plugin();
|
$plugin();
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
test('visual snapshot of test suite on success', function () {
|
test('visual snapshot of test suite on success', function () {
|
||||||
$testsPath = dirname(__DIR__);
|
$testsPath = dirname(__DIR__);
|
||||||
$snapshot = implode(DIRECTORY_SEPARATOR, [
|
$snapshot = implode(DIRECTORY_SEPARATOR, [
|
||||||
$testsPath,
|
$testsPath,
|
||||||
'.snapshots',
|
'.snapshots',
|
||||||
'success.txt',
|
'success.txt',
|
||||||
|
|||||||
Reference in New Issue
Block a user