PHPUnit 3.7 Manual

by (2014)
122 Flashcards & Notes
3 Students
  • This summary
  • +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:

    1. The tests for a class Class go into a class ClassTest

    2. ClassTest inherits (most of the time) from PHPUnit_Framework_TestCase

    3. The tests are public methods that are named test*

    4. Alternatively, you can use the @test annotation in a method's docblock to mark it as a test method

    5. 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 Dependencies

  • Does PHPUnit supports dependencies declaration between test methods ?
    Yes
  • How calls the method which yields its unit under test as return value ?
    Producer
  • What behavior describes  a consumer test method ?
    Consumer method is a test method that depends on one or more producers and their return values
  • Call the annotation tag which express dependencies between test methods
    @depends
  • 4.2 Data Providers

  • When a test receives input from both a @dataProvider method and from one or more tests it@depends on, 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
    @dataProvider
  • A data provider method must be public and either return an array of arrays or an object that implements the Iterator interface 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
    `dgfhf
  • kjh
    yfh
  • dg
    dgjdg
  • ghj
    fghj
  • hjk
    ghkghj
  • dgfjdgyj
    etyuetyu
  • ghj
    hjgfhj
  • dfg
    sdfgsdf
  • df
    sdfasdf1
  • 4.3 Testing Exceptions

  • List all annotation tags for testing exceptions
    @expectedException
    @expectedExceptionMessage
    @expectedExceptionCode
  • sdf
    sdf
  • This is a test ?
    Yes
  • rtyrt
    eter
  • sdf
    dfsdf
  • rewt ewrt er
  • qdeswrfqwe qertgew rtqer
  • ewr twe rt
  •  ewrwert ret ewrt wert wert
  • sdfasdf
    sasdadsg agagf
  • sdsdgsd
    dssdsdg
  • ewrwer
    dfdsgf
  • sdfdfVCV
    ssdgfdbq
  • jhjy
    hjk
  • ,jhkjlkjl
    ,khj,
  • kj.jm
    j.,
  • kj.jm
    j.,
  • f d gdfgfdcgfsdmfsnd,nmJNKHJL
    Ojkuhkijll
  • g j gjuhlkhkj

    gh
    dfg
    hdf
    gh
    fgh
    df
  • sdfgsfh f

    f
    dgh
    dfg
    df
    gd
    fgj
  • dsfhfghfbdf
    g
    fdg
    dfg
    df
    g
  • dasdsdffg
    fds
    gsd
    fg
    s
  • fdhdf

    dfgh
    df
    gh
  • hgfhfhg
  • hgffjhfhj
  • hjfjhfjhf
  • jhguyg
    uiyihoi
  • tryruy
  • yuryyi
  • t
  • t
  • t
  • t
Read the full summary
This summary. +380.000 other summaries. A unique study tool. A rehearsal system for this summary. Studycoaching with videos.

Example questions in this summary

sdf
5
List all annotation tags for testing exceptions
4
Call the annotation tag by which data provider method to be used is specified
3
This is a test ?
3
Page 1 of 9