https://github.com/phpnomad/tests
Shared testing utilities and base classes for PHPNomad packages
https://github.com/phpnomad/tests
framework php phpnomad phpunit platform-agnostic testing
Last synced: 14 days ago
JSON representation
Shared testing utilities and base classes for PHPNomad packages
- Host: GitHub
- URL: https://github.com/phpnomad/tests
- Owner: phpnomad
- License: mit
- Created: 2023-10-05T10:03:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-04-10T02:14:34.000Z (about 2 months ago)
- Last Synced: 2026-04-10T02:36:24.726Z (about 2 months ago)
- Topics: framework, php, phpnomad, phpunit, platform-agnostic, testing
- Language: PHP
- Homepage: https://phpnomad.com
- Size: 69.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# phpnomad/tests
[](https://packagist.org/packages/phpnomad/tests)
[](https://packagist.org/packages/phpnomad/tests)
[](https://packagist.org/packages/phpnomad/tests)
[](https://packagist.org/packages/phpnomad/tests)
`phpnomad/tests` is the shared PHPUnit base that PHPNomad packages use for their own unit tests. It provides a `TestCase` wired up with Mockery-PHPUnit integration and two reflection traits for reaching into protected or private state. If you're writing application code against PHPNomad, you don't need this package. If you're contributing to a PHPNomad package, its `tests/` directory almost certainly already depends on it.
## Installation
```bash
composer require --dev phpnomad/tests
```
Pull it in as a dev dependency only. It isn't meant for production code paths.
## What's included
- `PHPNomad\Tests\TestCase` extends `PHPUnit\Framework\TestCase` and mixes in `MockeryPHPUnitIntegration`, so Mockery expectations are verified and containers cleaned up automatically between tests.
- `PHPNomad\Tests\Traits\WithInaccessibleMethods` provides `callInaccessibleMethod()` for invoking protected or private methods through reflection.
- `PHPNomad\Tests\Traits\WithInaccessibleProperties` provides `getProtectedProperty()`, `getProtectedPropertyValue()`, and `setProtectedProperty()` for reading and writing protected or private properties through reflection.
## Usage pattern
Each PHPNomad package defines its own package-local `TestCase` that extends the shared one. That gives the package its own namespace root under `Tests/` while inheriting the PHPUnit and Mockery plumbing.
```php
callInaccessibleMethod($builder, 'normalize', '');
$this->assertSame('', $result);
}
}
```
## Documentation
Framework-wide documentation lives at [phpnomad.com](https://phpnomad.com).
## License
MIT. See [LICENSE.txt](LICENSE.txt).