+380.000 other summaries
A unique study tool
A rehearsal system for this summary
Studycoaching with videos
Remember faster, study better. Scientifically proven.
PREMIUM summaries are quality controlled, selected summaries prepared for you to help you achieve your study goals faster!
Summary - PHPUnit 3.7 Manual
4 Writing Tests for PHPUnit
The basic conventions and steps for writing tests with PHPUnit:
The tests for a class
Classgo into a class
ClassTestinherits (most of the time) from
The tests are public methods that are named
Alternatively, you can use the
@testannotation in a method's docblock to mark it as a test method
Inside the test methods, assertion methods such as
assertEquals()(see the section called “Assertions”) are used to assert that an actual value matches an expected value.
4.1 Test DependenciesDoes PHPUnit supports dependencies declaration between test methods ?YesHow calls the method which yields its unit under test as return value ?ProducerWhat behavior describes a consumer test method ?Consumer method is a test method that depends on one or more producers and their return valuesCall the annotation tag which express dependencies between test methods@depends
4.2 Data ProvidersWhen a test receives input from both a
@dataProvidermethod and from one or more tests it
@dependson, the arguments from the data provider will come before the ones from depended-upon tests. The arguments from depended-upon tests will be the same for each data set.
Call the annotation tag by which data provider method to be used is specified@dataProviderA data provider method must be
publicand either return an array of arrays or an object that implements the
Iteratorinterface and yields an array for each iteration step. For each array that is part of the collection the test method will be called with the contents of the array as its arguments.gfhgt`dgfhfkjhyfhdgdgjdgghjfghjhjkghkghjdgfjdgyjetyuetyughjhjgfhjdfgsdfgsdfdfsdfasdf1
4.3 Testing ExceptionsList all annotation tags for testing exceptions@expectedException
@expectedExceptionCodesdfsdfThis is a test ?Yesrtyrtetersdfdfsdfrewt ewrt erqdeswrfqwe qertgew rtqerewr twe rtewrwert ret ewrt wert wertsdfasdfsasdadsg agagfsdsdgsddssdsdgewrwerdfdsgfsdfdfVCVssdgfdbqjhjyhjk,jhkjlkjl,khj,kj.jmj.,kj.jmj.,f d gdfgfdcgfsdmfsnd,nmJNKHJLOjkuhkijllg j gjuhlkhkj
ghhgfhfhghgffjhfhjhjfjhfjhfjhguyguiyihoitryruyyuryyitttRead the full summaryThis summary. +380.000 other summaries. A unique study tool. A rehearsal system for this summary. Studycoaching with videos.