PHPUnit
PHPUnit
Développé par | Sebastian Bergmann |
---|---|
Première version | |
Dernière version | 11.5.3 ()[1] |
Dépôt | github.com/sebastianbergmann/phpunit |
Assurance qualité | Intégration continue |
Écrit en | PHP |
Environnement | Multiplateforme |
Langues | Anglais |
Type | Framework |
Licence | Licence BSD |
Site web | phpunit.de |
PHPUnit est un framework open source de tests unitaires dédié au langage de programmation PHP[2].
Il permet l'implémentation des tests de régression en vérifiant que les exécutions correspondent aux assertions prédéfinies.
Historique
Créé par Sebastian Bergmann en 2004, il intègre les concepts communs aux bibliothèques de tests unitaires xUnit. Le code source de PHPUnit est hébergé sur GitHub[2].
Utilisations
- CakePHP depuis la V2
- eZ Components
- Horde 4
- Laravel
- Propel
- Serendipity
- Symfony depuis la V2
- Zend Framework
Exemple
<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
class StackTest extends TestCase
{
public function testPushAndPop(): void
{
$stack = array();
$this->assertEquals(0, count($stack));
array_push($stack, 'foo');
$this->assertEquals('foo', $stack[count($stack)-1]);
$this->assertEquals(1, count($stack));
$this->assertEquals('foo', array_pop($stack));
$this->assertEquals(0, count($stack));
}
}
Références
- ↑ « Release 11.5.3 », (consulté le )
- Page GitHub PHPUnit