Overview

Packages

  • tipy

Classes

  • Tipy
  • TipyApp
  • TipyCli
  • TipyCliSession
  • TipyConfig
  • TipyController
  • TipyCookie
  • TipyDAO
  • TipyEnv
  • TipyFlash
  • TipyInflector
  • TipyInput
  • TipyIOWrapper
  • TipyLogger
  • TipyMailer
  • TipyModel
  • TipyOutput
  • TipyRequest
  • TipySession
  • TipyTestCase
  • TipyTestRunner
  • TipyView

Exceptions

  • AssertionFailedException
  • CompileErrorException
  • CompileWarningException
  • CoreErrorException
  • CoreWarningException
  • DeprecatedException
  • NoMethodException
  • NoticeException
  • ParseException
  • RecoverableErrorException
  • StrictException
  • TipyDaoException
  • TipyException
  • TipyModelException
  • TipyRollbackException
  • TipyValidationException
  • UserDeprecatedException
  • UserErrorException
  • UserNoticeException
  • UserWarningException
  • WarningException
  • Overview
  • Package
  • Class
  • Deprecated
  • Todo

Class TipyTestCase

Tipy Test Framework

TipyTestUnit is the implementation of the xUnit test framework

class SimpleTest extends TipyTestCase {

    public function testExample() {
        $this->assertEqual(1, true);
    }

}

Conventions

  • Tests and fixtures live in tests directory
  • Fixtures are plain .sql files
  • Test case file names end with Test (like MyTest.php)
  • Test case file contains one class
  • Test case is a class extending TipyTestCase
  • Test case class have the same name as the file containing it
  • Tests are public methods starting with test (like testExample)
Package: tipy
See: TipyTestRunner
Located at src/TipyTestUnit.php
Methods summary
public
# __construct( )
public
# run( )

Run test suite

Run test suite

Execute all test* methods from test suite and collect results

public
# setUp( )

Hook called before each test execution

Hook called before each test execution

Override this in your test suite

public
# tearDown( )

Hook called after each test execution

Hook called after each test execution

Override this in your test suite

public
# assertEqual( mixed $actual, mixed $expected )

Report an error if $actual and $expected are not equal

Report an error if $actual and $expected are not equal

Parameters

$actual
$expected

Throws

AssertionFailedException
public
# assertNotEqual( mixed $actual, mixed $expected )

Report an error if $actual and $expected are equal

Report an error if $actual and $expected are equal

Parameters

$actual
$expected

Throws

AssertionFailedException
public
# assertIdentical( mixed $actual, mixed $expected )

Report an error if $actual and $expected are not identical

Report an error if $actual and $expected are not identical

Parameters

$actual
$expected

Throws

AssertionFailedException
public
# assertNull( mixed $actual )

Report an error if $actual is not null

Report an error if $actual is not null

Parameters

$actual

Throws

AssertionFailedException
public
# assertNotNull( mixed $actual )

Report an error if $actual is null

Report an error if $actual is null

Parameters

$actual

Throws

AssertionFailedException
public
# assertTrue( mixed $actual )

Report an error if $actual is false

Report an error if $actual is false

Parameters

$actual

Throws

AssertionFailedException
public
# assertFalse( mixed $actual )

Report an error if $actual is true

Report an error if $actual is true

Parameters

$actual

Throws

AssertionFailedException
public
# assertThrown( string $exceptionClass, string $exceptionMessage, closure $closure )

Report an error if $closure does not throw $exceptionClass with $exceptionMessage

Report an error if $closure does not throw $exceptionClass with $exceptionMessage

Parameters

$exceptionClass
$exceptionMessage
$closure

Throws

AssertionFailedException
public
# assertThrownRegexp( string $expectedClassString, regexp $expectedMessageRegexp, closure $closure )

Report an error if $closure does not throw $exceptionClass or $exceptionMessage does not match $expectedMessageRegexp

Report an error if $closure does not throw $exceptionClass or $exceptionMessage does not match $expectedMessageRegexp

Parameters

$expectedClassString
$expectedMessageRegexp
$closure

Throws

AssertionFailedException
public array
# getSummary( )

Return test suite execution results

Return test suite execution results

Returns

array
Properties summary
public boolean $transactionalFixtures

Set this to false to turn off transactional fixtures

Set this to false to turn off transactional fixtures

Every test is wrapped in transaction to restore database state after test is finished.

There are some cases when you might want to turn this behaviour off:

  • To test real transactions
  • Your database does not support transactions
# true
tipy API documentation generated by ApiGen