Phpunit

XML Configuration File

  • phpunit.xml -> nicht in git; persönliche Variablen speichern

  • phpunit.xml.dist -> in git

<php>
    <env name="foo" value="bar" force="true"/>
</php>

Packages

Skipping, Incomplete

$this->markTestSkipped('reason');
$this->markTestIncomplete('reason');

Mocking

Stubs

The practice of replacing an object with a test double that (optionally) returns configured return values is referred to as stubbing. - PHPUnit

Mocking

The practice of replacing an object with a test double that verifies expectations, for instance asserting that a method has been called, is referred to as mocking. - Mock Pbjects

Hard Dependencys

Wenn Klasse in einer anderen Funktion erstellt wird (Mockery erforderlich)

Wie mache ich das mit PHPUnit?

Last updated

Was this helpful?