[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/core/ -> DokuWikiTest.php (summary)

(no description)

File Size: 272 lines (9 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

PHPUnit_Framework_TestCase:: (1 method):
  setExpectedException()

DokuWikiTest:: (8 methods):
  setUpBeforeClass()
  setUp()
  setupDataDir()
  setupConfDir()
  waitForTick()
  callInaccessibleMethod()
  getInaccessibleProperty()
  setInaccessibleProperty()


Class: PHPUnit_Framework_TestCase  - X-Ref

phpunit 5/6 compatibility

setExpectedException($class, $message=null)   X-Ref
setExpectedException is deprecated in PHPUnit 6

param: string $class
param: null|string $message

Class: DokuWikiTest  - X-Ref

Helper class to provide basic functionality for tests

setUpBeforeClass()   X-Ref
Setup the data directory

This is ran before each test class

setUp()   X-Ref
Reset the DokuWiki environment before each test run. Makes sure loaded config,
language and plugins are correct.

return: void

setupDataDir()   X-Ref
Reinitialize the data directory for this class run


setupConfDir()   X-Ref
Reinitialize the conf directory for this class run


waitForTick($init = false)   X-Ref
Waits until a new second has passed

This tried to be clever about the passing of time and return early if possible. Unfortunately
this never worked reliably fo unknown reasons. To avoid flaky tests, this now always simply
sleeps for a full second on every call.

param: bool $init no longer used
return: int new timestamp

callInaccessibleMethod($obj, $func, array $args)   X-Ref
Allow for testing inaccessible methods (private or protected)

This makes it easier to test protected methods without needing to create intermediate
classes inheriting and changing the access.

param: object $obj Object in which to call the method
param: string $func The method to call
param: array $args The arguments to call the method with
link: https://stackoverflow.com/a/8702347/172068
return: mixed

getInaccessibleProperty($obj, $prop)   X-Ref
Allow for reading inaccessible properties (private or protected)

This makes it easier to check internals of tested objects. This should generally
be avoided.

param: object $obj Object on which to access the property
param: string $prop name of the property to access
return: mixed

setInaccessibleProperty($obj, $prop, $value)   X-Ref
Allow for reading inaccessible properties (private or protected)

This makes it easier to set internals of tested objects. This should generally
be avoided.

param: object $obj Object on which to access the property
param: string $prop name of the property to access
param: mixed $value new value to set the property to
return: void