DB Testing Phpunit
DB Testing Phpunit
Ade Slade
Overview
Introduction
Installation
Getting started
Assertions
Examples
Introduction
PHPUnit
Test Framework
Very marvellous
> SimpleTest?
Installation
Getting started
Extend PHPUnit_Extensions_Database_TestCase
getDataSet
getConnection
Test Case
CODE EXAMPLE
DataSets
Flat XML
XML
Yaml
CSV
Composite
Replacement
Aggregating datasets
Replace values in the DataSet
Filter
DataSet
Set of tables
DataTable
Individual table
$this->getConnection()->createDataSet()
$this->getConnection()->createQueryTable()
PHPUnit_Extensions_Database_DataSet_QueryDataSet
Assertions
assertDataSetsEqual
assertTablesEqual
getRowCount
user table
User object
Schema
Summary
Resources
PHPUnit manual
http://www.digitalsandwich.com
http://www.beberlei.de/dbunit.html
http://www.phpunit.de/manual/current/en/database.html
On slideshare
On slideshare
Yay! Finished
email: [email protected]
twitter: @adeslade
web: http://adeslade.co.uk
github: https://github.com/adeslade/DBTesting