mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 17:57:23 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b79ba5098b | |||
| 3c418d82e6 | |||
| 73ede2e344 | |||
| 266d891488 | |||
| c71490b472 | |||
| 07705079e2 | |||
| d88c268426 | |||
| a1b142e885 | |||
| a50d739e50 | |||
| f82bb56d89 | |||
| de593c3b93 | |||
| eedd5d80a0 |
@ -4,9 +4,18 @@ 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/).
|
||||||
|
|
||||||
|
## [v0.3.14 (2020-11-28)](https://github.com/pestphp/pest/compare/v0.3.13...v0.3.14)
|
||||||
|
### Added
|
||||||
|
- `pest:dusk` command ([#223](https://github.com/pestphp/pest/pull/223))
|
||||||
|
- Better feedback on errors in `toMatchArray` and `toMatchObject` ([#231](https://github.com/pestphp/pest/pull/231))
|
||||||
|
|
||||||
## [v0.3.13 (2020-11-23)](https://github.com/pestphp/pest/compare/v0.3.12...v0.3.13)
|
## [v0.3.13 (2020-11-23)](https://github.com/pestphp/pest/compare/v0.3.12...v0.3.13)
|
||||||
### Added
|
### Added
|
||||||
- `toMatchArray` expectation ([7bea51f](https://github.com/pestphp/pest/commit/7bea51fe09dd2eca7093e4c34cf2dab2e8d39fa5), [3fd24d9](https://github.com/pestphp/pest/commit/3fd24d96d3145dcebdb0aab40aa8b76faa8b6979))
|
- `toMatchArray` expectation ([7bea51f](https://github.com/pestphp/pest/commit/7bea51fe09dd2eca7093e4c34cf2dab2e8d39fa5), [3fd24d9](https://github.com/pestphp/pest/commit/3fd24d96d3145dcebdb0aab40aa8b76faa8b6979))
|
||||||
|
- Add Pest options to `--help` output ([#217](https://github.com/pestphp/pest/pull/217))
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Resolve issue with name resolution in `depends()` ([#216](https://github.com/pestphp/pest/pull/216))
|
||||||
|
|
||||||
## [v0.3.12 (2020-11-11)](https://github.com/pestphp/pest/compare/v0.3.11...v0.3.12)
|
## [v0.3.12 (2020-11-11)](https://github.com/pestphp/pest/compare/v0.3.11...v0.3.12)
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
16
RELEASE.md
Normal file
16
RELEASE.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Release process
|
||||||
|
|
||||||
|
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`
|
||||||
|
- 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
|
||||||
|
- Update the version number in [src/Pest.php](src/Pest.php)
|
||||||
|
- Run the tests locally using: `composer test`
|
||||||
|
- Commit the CHANGELOG and Pest file with the message: `git commit -m "docs: update changelog"`
|
||||||
|
- Push the changes to GitHub
|
||||||
|
- Check that the CI is passing as expected: [github.com/pestphp/pest/actions](https://github.com/pestphp/pest/actions)
|
||||||
|
- Tag and push the tag with `git tag vX.X.X && git push --tags`
|
||||||
|
|
||||||
|
### Plugins
|
||||||
|
|
||||||
|
Plugins should be versioned using the same major (or minor for `0.x` releases) version as Pest core.
|
||||||
@ -44,6 +44,7 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"illuminate/console": "^7.16.1",
|
"illuminate/console": "^7.16.1",
|
||||||
"illuminate/support": "^7.16.1",
|
"illuminate/support": "^7.16.1",
|
||||||
|
"laravel/dusk": "^6.9.0",
|
||||||
"mockery/mockery": "^1.4.1",
|
"mockery/mockery": "^1.4.1",
|
||||||
"pestphp/pest-dev-tools": "dev-master"
|
"pestphp/pest-dev-tools": "dev-master"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -6,6 +6,7 @@ namespace Pest;
|
|||||||
|
|
||||||
use PHPUnit\Framework\Assert;
|
use PHPUnit\Framework\Assert;
|
||||||
use PHPUnit\Framework\Constraint\Constraint;
|
use PHPUnit\Framework\Constraint\Constraint;
|
||||||
|
use SebastianBergmann\Exporter\Exporter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -23,6 +24,15 @@ final class Expectation
|
|||||||
*/
|
*/
|
||||||
public $value;
|
public $value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The exporter instance, if any.
|
||||||
|
*
|
||||||
|
* @readonly
|
||||||
|
*
|
||||||
|
* @var Exporter|null
|
||||||
|
*/
|
||||||
|
private $exporter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new expectation.
|
* Creates a new expectation.
|
||||||
*
|
*
|
||||||
@ -508,8 +518,24 @@ final class Expectation
|
|||||||
*/
|
*/
|
||||||
public function toMatchArray($array): Expectation
|
public function toMatchArray($array): Expectation
|
||||||
{
|
{
|
||||||
foreach ($array as $property => $value) {
|
if (is_object($this->value) && method_exists($this->value, 'toArray')) {
|
||||||
$this->toHaveKey($property, $value);
|
$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;
|
return $this;
|
||||||
@ -524,7 +550,19 @@ final class Expectation
|
|||||||
public function toMatchObject($object): Expectation
|
public function toMatchObject($object): Expectation
|
||||||
{
|
{
|
||||||
foreach ((array) $object as $property => $value) {
|
foreach ((array) $object as $property => $value) {
|
||||||
$this->toHaveProperty($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;
|
return $this;
|
||||||
@ -550,6 +588,20 @@ final class Expectation
|
|||||||
return $this;
|
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.
|
* Dynamically calls methods on the class without any arguments.
|
||||||
*
|
*
|
||||||
|
|||||||
41
src/Laravel/Commands/PestDuskCommand.php
Normal file
41
src/Laravel/Commands/PestDuskCommand.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Pest\Laravel\Commands;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Console\DuskCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class PestDuskCommand extends DuskCommand
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The console command name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'pest:dusk {--without-tty : Disable output to TTY}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Run the Dusk tests for the application with Pest';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the PHP binary to execute.
|
||||||
|
*
|
||||||
|
* @return array<string>
|
||||||
|
*/
|
||||||
|
protected function binary()
|
||||||
|
{
|
||||||
|
if ('phpdbg' === PHP_SAPI) {
|
||||||
|
return [PHP_BINARY, '-qrr', 'vendor/bin/pest'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [PHP_BINARY, 'vendor/bin/pest'];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,7 +5,9 @@ declare(strict_types=1);
|
|||||||
namespace Pest\Laravel;
|
namespace Pest\Laravel;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Laravel\Dusk\Console\DuskCommand;
|
||||||
use Pest\Laravel\Commands\PestDatasetCommand;
|
use Pest\Laravel\Commands\PestDatasetCommand;
|
||||||
|
use Pest\Laravel\Commands\PestDuskCommand;
|
||||||
use Pest\Laravel\Commands\PestInstallCommand;
|
use Pest\Laravel\Commands\PestInstallCommand;
|
||||||
use Pest\Laravel\Commands\PestTestCommand;
|
use Pest\Laravel\Commands\PestTestCommand;
|
||||||
|
|
||||||
@ -22,6 +24,12 @@ final class PestServiceProvider extends ServiceProvider
|
|||||||
PestTestCommand::class,
|
PestTestCommand::class,
|
||||||
PestDatasetCommand::class,
|
PestDatasetCommand::class,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (class_exists(DuskCommand::class)) {
|
||||||
|
$this->commands([
|
||||||
|
PestDuskCommand::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,5 +6,5 @@ namespace Pest;
|
|||||||
|
|
||||||
function version(): string
|
function version(): string
|
||||||
{
|
{
|
||||||
return '0.3.12';
|
return '0.3.14';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user