yegor256 / phprack
Light framework for automation of integration tests
Installs: 4 668
Dependents: 0
Suggesters: 0
Security: 0
Stars: 25
Watchers: 3
Forks: 5
Open Issues: 29
pkg:composer/yegor256/phprack
Requires
- php: >=5.2.0
This package is not auto-updated.
Last update: 2026-02-18 13:16:07 UTC
README
Read about phpRack in php|Architect June 2010: Integration Testing with phpRack Framework.
phpRack is a lightweight framework for integration test automation. Integration tests are checks that run in the production environment to validate that it is configured as expected. For example, your product is a web application that depends on PHP, Apache, MySQL, and the availability of YouTube, Flickr, and Google Maps APIs. Your product is tested with unit tests that use stubs for these services and components. When the product is deployed to production, you want to be sure that the services you need are configured and available. If they are not, you want a detailed notification before your end-users notice.
This is where phpRack helps. Add phpRack to your project and write a few tests. All these tests will be executed when requested and will produce a detailed report, both online and by email. It will save you a lot of time during deployment and later, during maintenance of your product.
To start using phpRack, follow these three steps:
- Upload phpRack library to your server
- Create
phprack.phpfile in yourpublic_htmldirectory - Create PHP integration tests in your rack-tests directory
Let's do them one by one:
Download ZIP archive
of phpRack and unpack it to public_html/phpRack or some other directory on
your production server.
Create phprack.php in your project's public directory
(see full reference), e.g.:
<?php // this param is mandatory, others are optional $phpRackConfig = array( 'dir' => '../rack-tests', ); // absolute path to the bootstrap script on your server include '../library/phpRack/bootstrap.php';
Write integration tests in the rack-tests directory. Each test must extend
phpRack_Test (see
full list of assertions).
For example, file MyTest.php:
<?php class MyTest extends phpRack_Test { public function testPhpVersionIsCorrect() { $this->assert->php->version ->atLeast('5.2'); } public function testPhpExtensionsExist() { $this->assert->php->extensions ->isLoaded('xsl') ->isLoaded('simplexml') ->isLoaded('fileinfo'); } }
Go to this URL: http://your-website-url/phprack.php and enjoy.
Try this link to see what you're going to see on your site:
http://www.phprack.com/phprack.php.
How to contribute?
Fork the repository, clone it to your local machine, and install dependencies:
composer install
Then run the build:
./vendor/bin/phing
All tests should pass. If you see any problems, please submit a new issue.
After making your changes, run phing again to make sure you didn't break anything.
When ready, submit a pull request.