Prev Next

Appendix D. Index

Symbols

$backupGlobalsBlacklist, Global State
$backupStaticAttributesBlacklist, Global State
@assert, Generating a Test Case Class Skeleton, @assert
@author, Command-Line switches, @author
@backupGlobals, Global State, @backupGlobals
@backupStaticAttributes, Global State, @backupStaticAttributes
@codeCoverageIgnore, Ignoring Code Blocks, @codeCoverageIgnore*
@codeCoverageIgnoreEnd, Ignoring Code Blocks, @codeCoverageIgnore*
@codeCoverageIgnoreStart, Ignoring Code Blocks, @codeCoverageIgnore*
@covers, Specifying Covered Methods, @covers
@dataProvider, Data Providers, @dataProvider
@depends, Test Dependencies, Data Providers, @depends
@expectedException, Testing Exceptions, @expectedException
@expectedExceptionCode, Testing Exceptions, @expectedExceptionCode
@expectedExceptionMessage, Testing Exceptions, @expectedExceptionMessage
@group, Command-Line switches, @group
@outputBuffering, @outputBuffering
@runInSeparateProcess, @runInSeparateProcess
@runTestsInSeparateProcesses, @runTestsInSeparateProcesses
@test, Writing Tests for PHPUnit, @test
@testdox, @testdox
@ticket, @ticket

A

Agile Documentation, Command-Line switches, Agile Documentation
Annotation, Writing Tests for PHPUnit, Test Dependencies, Data Providers, Testing Exceptions, Command-Line switches, Specifying Covered Methods, Ignoring Code Blocks, Generating a Test Case Class Skeleton, Annotations
anything(), assertThat()
arrayHasKey(), assertThat()
assertArrayHasKey(), assertArrayHasKey(), Assertions
assertArrayNotHasKey(), assertArrayHasKey(), Assertions
assertAttributeContains(), assertContains(), Assertions
assertAttributeContainsOnly(), assertContainsOnly(), Assertions
assertAttributeEmpty(), assertEmpty(), Assertions
assertAttributeEquals(), assertEquals(), Assertions
assertAttributeGreaterThan(), assertGreaterThan(), Assertions
assertAttributeGreaterThanOrEqual(), assertGreaterThanOrEqual(), Assertions
assertAttributeInstanceOf(), assertInstanceOf(), Assertions
assertAttributeInternalType(), assertInternalType(), Assertions
assertAttributeLessThan(), assertLessThan(), Assertions
assertAttributeLessThanOrEqual(), assertLessThanOrEqual(), Assertions
assertAttributeNotContains(), assertContains(), Assertions
assertAttributeNotContainsOnly(), assertContainsOnly(), Assertions
assertAttributeNotEmpty(), assertEmpty(), Assertions
assertAttributeNotEquals(), assertEquals(), Assertions
assertAttributeNotInstanceOf(), assertInstanceOf(), Assertions
assertAttributeNotInternalType(), assertInternalType(), Assertions
assertAttributeNotSame(), assertSame(), Assertions
assertAttributeSame(), assertSame(), Assertions
assertClassHasAttribute(), assertClassHasAttribute(), Assertions
assertClassHasStaticAttribute(), assertClassHasStaticAttribute(), Assertions
assertClassNotHasAttribute(), assertClassHasAttribute(), Assertions
assertClassNotHasStaticAttribute(), assertClassHasStaticAttribute(), Assertions
assertContains(), assertContains(), Assertions
assertContainsOnly(), assertContainsOnly(), Assertions
assertCount(), assertCount(), Assertions
assertEmpty(), assertEmpty(), Assertions
assertEquals(), assertEquals(), Assertions
assertEqualXMLStructure(), assertEqualXMLStructure(), Assertions
assertFalse(), assertFalse(), Assertions
assertFileEquals(), assertFileEquals(), Assertions
assertFileExists(), assertFileExists(), Assertions
assertFileNotEquals(), assertFileEquals(), Assertions
assertFileNotExists(), assertFileExists(), Assertions
assertGreaterThan(), assertGreaterThan(), Assertions
assertGreaterThanOrEqual(), assertGreaterThanOrEqual(), Assertions
assertInstanceOf(), assertInstanceOf(), Assertions
assertInternalType(), assertInternalType(), Assertions
Assertion, @assert
Assertions, Automating Tests
assertLessThan(), assertLessThan(), Assertions
assertLessThanOrEqual(), assertLessThanOrEqual(), Assertions
assertNotContains(), assertContains(), Assertions
assertNotContainsOnly(), assertContainsOnly(), Assertions
assertNotCount(), assertCount(), Assertions
assertNotEmpty(), assertEmpty(), Assertions
assertNotEquals(), assertEquals(), Assertions
assertNotInstanceOf(), assertInstanceOf(), Assertions
assertNotInternalType(), assertInternalType(), Assertions
assertNotNull(), assertNull(), Assertions
assertNotRegExp(), assertRegExp(), Assertions
assertNotSame(), assertSame(), Assertions
assertNotTag(), assertTag(), Assertions
assertNull(), assertNull(), Assertions
assertObjectHasAttribute(), assertObjectHasAttribute(), Assertions
assertObjectNotHasAttribute(), assertObjectHasAttribute(), Assertions
assertPostConditions(), Fixtures
assertPreConditions(), Fixtures
assertRegExp(), assertRegExp(), Assertions
assertSame(), assertSame(), Assertions
assertSelectCount(), assertSelectCount(), Assertions
assertSelectEquals(), assertSelectEquals(), Assertions
assertSelectRegExp(), assertSelectRegExp(), Assertions
assertStringEndsNotWith(), assertStringEndsWith(), Assertions
assertStringEndsWith(), assertStringEndsWith(), Assertions
assertStringEqualsFile(), assertStringEqualsFile(), Assertions
assertStringMatchesFormat(), assertStringMatchesFormat(), Assertions
assertStringMatchesFormatFile(), assertStringMatchesFormatFile(), Assertions
assertStringNotEqualsFile(), assertStringEqualsFile(), Assertions
assertStringNotMatchesFormat(), assertStringMatchesFormat(), Assertions
assertStringNotMatchesFormatFile(), assertStringMatchesFormatFile(), Assertions
assertStringStartsNotWith(), assertStringStartsWith(), Assertions
assertStringStartsWith(), assertStringStartsWith(), Assertions
assertTag(), assertTag(), Assertions
assertThat(), assertThat(), Assertions
assertTrue(), assertTrue(), Assertions
assertXmlFileEqualsXmlFile(), assertXmlFileEqualsXmlFile(), Assertions
assertXmlFileNotEqualsXmlFile(), assertXmlFileEqualsXmlFile(), Assertions
assertXmlStringEqualsXmlFile(), assertXmlStringEqualsXmlFile(), Assertions
assertXmlStringEqualsXmlString(), assertXmlStringEqualsXmlString(), Assertions
assertXmlStringNotEqualsXmlFile(), assertXmlStringEqualsXmlFile(), Assertions
assertXmlStringNotEqualsXmlString(), assertXmlStringEqualsXmlString(), Assertions
attribute(), assertThat()
attributeEqualTo(), assertThat()
Automated Documentation, Agile Documentation
Automated Test, Automating Tests

D

Data-Driven Tests, Implement PHPUnit_Framework_Test
Defect Localization, Test Dependencies
Depended-On Component, Test Doubles
Design-by-Contract, Test-Driven Development
Documenting Assumptions, Agile Documentation
Domain-Driven Design, Behaviour-Driven Development

F

Failure, The Command-Line Test Runner
fileExists(), assertThat()
Fixture, Fixtures
Fluent Interface, Stubs

G

getMock(), Stubs
getMockBuilder(), Stubs
getMockForAbstractClass(), Mock Objects
getMockFromWsdl(), Stubbing and Mocking Web Services
Global Variable, Global State, Setting PHP INI settings, Constants and Global Variables
greaterThan(), assertThat()
greaterThanOrEqual(), assertThat()

H

hasAttribute(), assertThat()

I

identicalTo(), assertThat()
include_path, Command-Line switches
Incomplete Test, Incomplete Tests, Generating a Test Case Class Skeleton
isFalse(), assertThat()
isInstanceOf(), assertThat()
isNull(), assertThat()
isTrue(), assertThat()
isType(), assertThat()

L

lessThan(), assertThat()
lessThanOrEqual(), assertThat()
Logfile, Command-Line switches
Logging, Logging, Logging
logicalAnd(), assertThat()
logicalNot(), assertThat()
logicalOr(), assertThat()
logicalXor(), assertThat()

M

matchesRegularExpression(), assertThat()
method(), Stubs
Mock Object, Mock Objects

O

onConsecutiveCalls(), Stubs
onNotSuccessfulTest(), Fixtures

P

PHP Error, Testing PHP Errors
PHP Notice, Testing PHP Errors
PHP Warning, Testing PHP Errors
php.ini, Setting PHP INI settings, Constants and Global Variables
PHPUnit_Extensions_RepeatedTest, Subclass PHPUnit_Extensions_TestDecorator
PHPUnit_Extensions_Selenium2TestCase, PHPUnit_Extensions_Selenium2TestCase
PHPUnit_Extensions_SeleniumTestCase, PHPUnit_Extensions_SeleniumTestCase
PHPUnit_Extensions_Story_TestCase, Behaviour-Driven Development
PHPUnit_Extensions_TestDecorator, Subclass PHPUnit_Extensions_TestDecorator
PHPUnit_Extensions_TestSetup, Subclass PHPUnit_Extensions_TestDecorator
PHPUnit_Framework_Assert, BankAccount Example
PHPUnit_Framework_Error, Testing PHP Errors
PHPUnit_Framework_Error_Notice, Testing PHP Errors
PHPUnit_Framework_Error_Warning, Testing PHP Errors
PHPUnit_Framework_IncompleteTest, Incomplete Tests
PHPUnit_Framework_IncompleteTestError, Incomplete Tests
PHPUnit_Framework_Test, Implement PHPUnit_Framework_Test
PHPUnit_Framework_TestCase, Writing Tests for PHPUnit, Subclass PHPUnit_Framework_TestCase
PHPUnit_Framework_TestListener, Command-Line switches, Implement PHPUnit_Framework_TestListener, Test Listeners
PHPUnit_Runner_TestSuiteLoader, Command-Line switches
PHPUnit_Util_Printer, Command-Line switches
Process Isolation, Command-Line switches

R

Refactoring, During Development
Report, Command-Line switches
returnArgument(), Stubs
returnCallback(), Stubs
returnSelf(), Stubs
returnValue(), Stubs
returnValueMap(), Stubs

S

Selenium RC, Configuring Browsers for Selenium RC
Selenium Server, Selenium Server
setUp(), Fixtures
setUpBeforeClass, Sharing Fixture
setUpBeforeClass(), Fixtures
Skeleton Generator, Generating a Test Case Class Skeleton
stringContains(), assertThat()
stringEndsWith(), assertThat()
stringStartsWith(), assertThat()
Stub, Stubs
Stubs, Cross-Team Tests
System Under Test, Test Doubles

T

tearDown(), Fixtures
tearDownAfterClass, Sharing Fixture
tearDownAfterClass(), Fixtures
Template Method, Fixtures
Test Dependencies, Test Dependencies
Test Double, Test Doubles
Test Groups, Command-Line switches, Groups
Test Isolation, Command-Line switches, Global State
Test Listener, Test Listeners
Test Suite, Organizing Tests, Test Suites
Test-Driven Development, Test-Driven Development, Behaviour-Driven Development
Test-First Programming, Test-Driven Development
TestDox, Agile Documentation, @testdox
throwException(), Stubs
Prev Next
1. Automating Tests
2. PHPUnit's Goals
3. Installing PHPUnit
4. Writing Tests for PHPUnit
Test Dependencies
Data Providers
Testing Exceptions
Testing PHP Errors
Testing Output
Assertions
assertArrayHasKey()
assertClassHasAttribute()
assertClassHasStaticAttribute()
assertContains()
assertContainsOnly()
assertCount()
assertEmpty()
assertEqualXMLStructure()
assertEquals()
assertFalse()
assertFileEquals()
assertFileExists()
assertGreaterThan()
assertGreaterThanOrEqual()
assertInstanceOf()
assertInternalType()
assertLessThan()
assertLessThanOrEqual()
assertNull()
assertObjectHasAttribute()
assertRegExp()
assertStringMatchesFormat()
assertStringMatchesFormatFile()
assertSame()
assertSelectCount()
assertSelectEquals()
assertSelectRegExp()
assertStringEndsWith()
assertStringEqualsFile()
assertStringStartsWith()
assertTag()
assertThat()
assertTrue()
assertXmlFileEqualsXmlFile()
assertXmlStringEqualsXmlFile()
assertXmlStringEqualsXmlString()
Error output
Edge cases
5. The Command-Line Test Runner
Command-Line switches
6. Fixtures
More setUp() than tearDown()
Variations
Sharing Fixture
Global State
7. Organizing Tests
Composing a Test Suite Using the Filesystem
Composing a Test Suite Using XML Configuration
8. Database Testing
Supported Vendors for Database Testing
Difficulties in Database Testing
The four stages of a database test
1. Clean-Up Database
2. Set up fixture
3–5. Run Test, Verify outcome and Teardown
Configuration of a PHPUnit Database TestCase
Implementing getConnection()
Implementing getDataSet()
What about the Database Schema (DDL)?
Tip: Use your own Abstract Database TestCase
Understanding DataSets and DataTables
Available Implementations
Beware of Foreign Keys
Implementing your own DataSets/DataTables
The Connection API
Database Assertions API
Asserting the Row-Count of a Table
Asserting the State of a Table
Asserting the Result of a Query
Asserting the State of Multiple Tables
Frequently Asked Questions
Will PHPUnit (re-)create the database schema for each test?
Am I required to use PDO in my application for the Database Extension to work?
What can I do, when I get a Too much Connections Error?
How to handle NULL with Flat XML / CSV Datasets?
9. Incomplete and Skipped Tests
Incomplete Tests
Skipping Tests
10. Test Doubles
Stubs
Mock Objects
Stubbing and Mocking Web Services
Mocking the Filesystem
11. Testing Practices
During Development
During Debugging
12. Test-Driven Development
BankAccount Example
13. Behaviour-Driven Development
BowlingGame Example
14. Code Coverage Analysis
Specifying Covered Methods
Ignoring Code Blocks
Including and Excluding Files
Edge cases
15. Other Uses for Tests
Agile Documentation
Cross-Team Tests
16. Skeleton Generator
Generating a Test Case Class Skeleton
Generating a Class Skeleton from a Test Case Class
17. PHPUnit and Selenium
Selenium Server
Installation
PHPUnit_Extensions_Selenium2TestCase
PHPUnit_Extensions_SeleniumTestCase
18. Logging
Test Results (XML)
Test Results (TAP)
Test Results (JSON)
Code Coverage (XML)
Code Coverage (TEXT)
19. Extending PHPUnit
Subclass PHPUnit_Framework_TestCase
Write custom assertions
Implement PHPUnit_Framework_TestListener
Subclass PHPUnit_Extensions_TestDecorator
Implement PHPUnit_Framework_Test
A. Assertions
B. Annotations
@assert
@author
@backupGlobals
@backupStaticAttributes
@codeCoverageIgnore*
@covers
@dataProvider
@depends
@expectedException
@expectedExceptionCode
@expectedExceptionMessage
@group
@outputBuffering
@runTestsInSeparateProcesses
@runInSeparateProcess
@test
@testdox
@ticket
C. The XML Configuration File
PHPUnit
Test Suites
Groups
Including and Excluding Files for Code Coverage
Logging
Test Listeners
Setting PHP INI settings, Constants and Global Variables
Configuring Browsers for Selenium RC
D. Index
E. Bibliography
F. Copyright