mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
refacto: toHaveMethod and toHaveMethods
This commit is contained in:
@ -819,6 +819,14 @@
|
||||
✓ class has method via a parent class
|
||||
✓ class has method via a trait
|
||||
✓ failure when the class has no method
|
||||
✓ class has no method
|
||||
|
||||
PASS Tests\Features\Expect\toHaveMethods
|
||||
✓ class has method
|
||||
✓ opposite class has method
|
||||
✓ class has method via a parent class
|
||||
✓ class has method via a trait
|
||||
✓ failure when the class has no method
|
||||
✓ class has no method
|
||||
|
||||
PASS Tests\Features\Expect\toHaveMethodsDocumented
|
||||
@ -1559,4 +1567,4 @@
|
||||
WARN Tests\Visual\Version
|
||||
- visual snapshot of help command output
|
||||
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 28 skipped, 1079 passed (2609 assertions)
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 28 skipped, 1085 passed (2617 assertions)
|
||||
29
tests/Features/Expect/toHaveMethods.php
Normal file
29
tests/Features/Expect/toHaveMethods.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Pest\Arch\Exceptions\ArchExpectationFailedException;
|
||||
|
||||
test('class has method')
|
||||
->expect('Tests\Fixtures\Arch\ToHaveMethod\HasMethod\HasMethod')
|
||||
->toHaveMethods(['foo']);
|
||||
|
||||
test('opposite class has method')
|
||||
->throws(ArchExpectationFailedException::class)
|
||||
->expect('Tests\Fixtures\Arch\ToHaveMethod\HasMethod\HasMethod')
|
||||
->not->toHaveMethods(['foo']);
|
||||
|
||||
test('class has method via a parent class')
|
||||
->expect('Tests\Fixtures\Arch\ToHaveMethod\HasMethod\HasMethodViaParent')
|
||||
->toHaveMethods(['foo']);
|
||||
|
||||
test('class has method via a trait')
|
||||
->expect('Tests\Fixtures\Arch\ToHaveMethod\HasMethod\HasMethodViaTrait')
|
||||
->toHaveMethods(['foo']);
|
||||
|
||||
test('failure when the class has no method')
|
||||
->throws(ArchExpectationFailedException::class)
|
||||
->expect('Tests\Fixtures\Arch\ToHaveMethod\HasNoMethod\HasNoMethodClass')
|
||||
->toHaveMethods(['foo']);
|
||||
|
||||
test('class has no method')
|
||||
->expect('Tests\Fixtures\Arch\ToHaveMethod\HasNoMethod\HasNoMethodClass')
|
||||
->not->toHaveMethods(['foo']);
|
||||
@ -16,7 +16,7 @@ $run = function () {
|
||||
|
||||
test('parallel', function () use ($run) {
|
||||
expect($run('--exclude-group=integration'))
|
||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1069 passed (2585 assertions)')
|
||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1075 passed (2593 assertions)')
|
||||
->toContain('Parallel: 3 processes');
|
||||
})->skipOnWindows();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user