mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat: toHavePrivateMethodsBesides, toHaveProtectedMethodsBesides, toHavePublicMethodsBesides
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
|
||||
PASS Tests\Arch
|
||||
✓ arch "base" preset
|
||||
✓ arch "php" preset
|
||||
✓ arch "strict" preset
|
||||
✓ arch "security" preset
|
||||
✓ globals
|
||||
@ -831,6 +831,10 @@
|
||||
✓ opposite missing prefix
|
||||
✓ opposite has prefix
|
||||
|
||||
PASS Tests\Features\Expect\toHavePrivateMethodsBesides
|
||||
✓ pass
|
||||
✓ failures
|
||||
|
||||
PASS Tests\Features\Expect\toHaveProperties
|
||||
✓ pass
|
||||
✓ failures
|
||||
@ -849,6 +853,14 @@
|
||||
✓ failures with message and Any matcher
|
||||
✓ not failures
|
||||
|
||||
PASS Tests\Features\Expect\toHaveProtectedMethodsBesides
|
||||
✓ pass
|
||||
✓ failures
|
||||
|
||||
PASS Tests\Features\Expect\toHavePublicMethodsBesides
|
||||
✓ pass
|
||||
✓ failures
|
||||
|
||||
PASS Tests\Features\Expect\toHaveSameSize
|
||||
✓ failures with wrong type
|
||||
✓ pass
|
||||
@ -1547,4 +1559,4 @@
|
||||
WARN Tests\Visual\Version
|
||||
- visual snapshot of help command output
|
||||
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 24 skipped, 1078 passed (2632 assertions)
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 24 skipped, 1084 passed (2644 assertions)
|
||||
12
tests/Features/Expect/toHavePrivateMethodsBesides.php
Normal file
12
tests/Features/Expect/toHavePrivateMethodsBesides.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Pest\Arch\Exceptions\ArchExpectationFailedException;
|
||||
use Tests\Fixtures\Arch\ToHavePublicMethodsBesides\UserController;
|
||||
|
||||
test('pass', function () {
|
||||
expect(UserController::class)->not->toHavePrivateMethodsBesides(['privateMethod']);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(UserController::class)->not->toHavePrivateMethodsBesides([]);
|
||||
})->throws(ArchExpectationFailedException::class);
|
||||
12
tests/Features/Expect/toHaveProtectedMethodsBesides.php
Normal file
12
tests/Features/Expect/toHaveProtectedMethodsBesides.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Pest\Arch\Exceptions\ArchExpectationFailedException;
|
||||
use Tests\Fixtures\Arch\ToHavePublicMethodsBesides\UserController;
|
||||
|
||||
test('pass', function () {
|
||||
expect(UserController::class)->not->toHaveProtectedMethodsBesides(['protectedMethod']);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(UserController::class)->not->toHaveProtectedMethodsBesides([]);
|
||||
})->throws(ArchExpectationFailedException::class);
|
||||
12
tests/Features/Expect/toHavePublicMethodsBesides.php
Normal file
12
tests/Features/Expect/toHavePublicMethodsBesides.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Pest\Arch\Exceptions\ArchExpectationFailedException;
|
||||
use Tests\Fixtures\Arch\ToHavePublicMethodsBesides\UserController;
|
||||
|
||||
test('pass', function () {
|
||||
expect(UserController::class)->not->toHavePublicMethodsBesides(['publicMethod']);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
expect(UserController::class)->not->toHavePublicMethodsBesides([]);
|
||||
})->throws(ArchExpectationFailedException::class);
|
||||
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Fixtures\Arch\ToHavePublicMethodsBesides;
|
||||
|
||||
class UserController
|
||||
{
|
||||
public function publicMethod(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function protectedMethod(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
private function privateMethod(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@ -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, 1064 passed (2602 assertions)')
|
||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1070 passed (2612 assertions)')
|
||||
->toContain('Parallel: 3 processes');
|
||||
})->skipOnWindows();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user