Compare commits

...

11 Commits

Author SHA1 Message Date
58cff003d8 release: v1.19.0 2021-09-20 19:30:58 +01:00
ae997e6eee No need for --ignore-platform-req=php 2021-09-20 19:28:43 +01:00
e6c7d68def Adds php-81 support 2021-09-20 19:26:47 +01:00
2f0cd7a4e3 Adds Fathom Analytics as sponsor 2021-09-15 10:03:05 +01:00
447af55e7c Merge pull request #391 from gabbanaesteban/master
Add `toHaveProperties`
2021-09-03 09:52:39 +01:00
253e9d10c8 Fix types 2021-09-03 04:44:10 -04:00
536ce1eca0 Update snapshots 2021-09-03 04:40:48 -04:00
4331b2aaf6 Add toHaveProperties 2021-09-03 04:26:57 -04:00
8d99cacc95 Update README.md 2021-09-02 23:36:02 +01:00
3c38facc8a Update README.md 2021-09-02 23:35:51 +01:00
ed389d35d0 Adds Auth0 as sponsor 2021-09-02 23:35:40 +01:00
6 changed files with 56 additions and 10 deletions

View File

@ -8,7 +8,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
php: ['7.3', '7.4', '8.0'] php: ['7.3', '7.4', '8.0', '8.1']
dependency-version: [prefer-lowest, prefer-stable] dependency-version: [prefer-lowest, prefer-stable]
parallel: ['', '--parallel'] parallel: ['', '--parallel']
@ -30,13 +30,8 @@ jobs:
echo "::add-matcher::${{ runner.tool_cache }}/php.json" echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install PHP 7 dependencies - name: Install PHP dependencies
run: composer update --${{ matrix.dependency-version }} --no-interaction --no-progress run: composer update --${{ matrix.dependency-version }} --no-interaction --no-progress
if: "matrix.php < 8"
- name: Install PHP 8 dependencies
run: composer update --${{ matrix.dependency-version }} --ignore-platform-req=php --no-interaction --no-progress
if: "matrix.php >= 8"
- name: Unit Tests - name: Unit Tests
run: php bin/pest --colors=always --exclude-group=integration ${{ matrix.parallel }} run: php bin/pest --colors=always --exclude-group=integration ${{ matrix.parallel }}

View File

@ -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.19.0 (2021-09-20)](https://github.com/pestphp/pest/compare/v1.18.0...v1.19.0)
### Added
- PHP 8.1 support ([e6c7d68](https://github.com/pestphp/pest/commit/e6c7d68defaec8efe01e71e15dd8d8c45b0cf60f))
## [v1.18.0 (2021-08-30)](https://github.com/pestphp/pest/compare/v1.17.0...v1.18.0) ## [v1.18.0 (2021-08-30)](https://github.com/pestphp/pest/compare/v1.17.0...v1.18.0)
### Added ### Added
- `toHaveLength` expectation ([#386](https://github.com/pestphp/pest/pull/386)) - `toHaveLength` expectation ([#386](https://github.com/pestphp/pest/pull/386))

View File

@ -22,9 +22,11 @@ We would like to extend our thanks to the following sponsors for funding Pest de
### Premium Sponsors ### Premium Sponsors
- **[Akaunting](https://akaunting.com)** - **[Akaunting](https://akaunting.com)**
- **[Auth0](https://auth0.com)**
- **[Codecourse](https://codecourse.com/)** - **[Codecourse](https://codecourse.com/)**
- **[Meema](https://meema.io/)** - **[Fathom Analytics](https://usefathom.com/)**
- **[Meema](https://meema.io)**
- **[Scout APM](https://scoutapm.com)** - **[Scout APM](https://scoutapm.com)**
- **[Spatie](https://spatie.be/)** - **[Spatie](https://spatie.be)**
Pest is an open-sourced software licensed under the **[MIT license](https://opensource.org/licenses/MIT)**. Pest is an open-sourced software licensed under the **[MIT license](https://opensource.org/licenses/MIT)**.

View File

@ -386,6 +386,20 @@ final class Expectation
return $this; return $this;
} }
/**
* Asserts that the value contains the provided properties $names.
*
* @param iterable<array-key, string> $names
*/
public function toHaveProperties(iterable $names): Expectation
{
foreach ($names as $name) {
$this->toHaveProperty($name);
}
return $this;
}
/** /**
* Asserts that two variables have the same value. * Asserts that two variables have the same value.
* *

View File

@ -433,6 +433,11 @@
✓ it fails with (true) ✓ it fails with (true)
✓ it fails with (null) ✓ it fails with (null)
PASS Tests\Features\Expect\toHaveProperties
✓ pass
✓ failures
✓ not failures
PASS Tests\Features\Expect\toHaveProperty PASS Tests\Features\Expect\toHaveProperty
✓ pass ✓ pass
✓ failures ✓ failures
@ -676,5 +681,5 @@
✓ it is a test ✓ it is a test
✓ it uses correct parent class ✓ it uses correct parent class
Tests: 4 incompleted, 9 skipped, 444 passed Tests: 4 incompleted, 9 skipped, 447 passed

View File

@ -0,0 +1,26 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
$object = new stdClass();
$object->name = 'Jhon';
$object->age = 21;
expect($object)->toHaveProperties(['name', 'age']);
});
test('failures', function () {
$object = new stdClass();
$object->name = 'Jhon';
expect($object)->toHaveProperties(['name', 'age']);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
$object = new stdClass();
$object->name = 'Jhon';
$object->age = 21;
expect($object)->not->toHaveProperties(['name', 'age']);
})->throws(ExpectationFailedException::class);