1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166:
<?php
namespace Peridot\Core;
use Evenement\EventEmitterInterface;
/**
* Defines the contract for Peridot test fixtures like Test and Suite
*
* @package Peridot\Core
*/
interface TestInterface
{
/**
* @param TestResult $result
* @return mixed
*/
public function run(TestResult $result);
/**
* Add a function to execute before the test runs
*
* @param callable $setupFn
*/
public function addSetupFunction(callable $setupFn);
/**
* Return all registered setup functions
*
* @return array
*/
public function getSetupFunctions();
/**
* Add a function to execute after the test runs
*
* @param callable $tearDownFn
*/
public function addTearDownFunction(callable $tearDownFn);
/**
* Return all registered tear down functions
*
* @return array
*/
public function getTearDownFunctions();
/**
* @return string
*/
public function getDescription();
/**
* Returns the callable definition of the TestInterface
*
* @return callable
*/
public function getDefinition();
/**
* @return TestInterface
*/
public function getParent();
/**
* @param TestInterface $parent
* @return mixed
*/
public function setParent(TestInterface $parent);
/**
* Returns the full description including parent descriptions
*
* @return string
*/
public function getTitle();
/**
* Return whether or not the test is pending
*
* @return bool|null
*/
public function getPending();
/**
* Set the pending status of the test
*
* @param bool $state
* @return void
*/
public function setPending($state);
/**
* Return whether or not the test is focused
*
* @return bool
*/
public function isFocused();
/**
* Set the focused status of the test and its children according to the
* supplied focus pattern and/or skip pattern
*
* @param string|null $focusPattern
* @param string|null $skipPattern
*/
public function applyFocusPatterns($focusPattern, $skipPattern = null);
/**
* Return scope for this test. Scope contains instance variables
* for a spec
*
* @return Scope
*/
public function getScope();
/**
* Set the scope object for a test
*
* @param Scope $scope
* @return mixed
*/
public function setScope(Scope $scope);
/**
* @param EventEmitterInterface $emitter
* @return mixed
*/
public function setEventEmitter(EventEmitterInterface $emitter);
/**
* @return EventEmitterInterface
*/
public function getEventEmitter();
/**
* Execute a callback for each node in this test, starting
* at the bottom of the tree.
*
* @param callable $fn
*/
public function forEachNodeBottomUp(callable $fn);
/**
* Execute a callback for each node in this test, starting
* at the top of the tree.
*
* @param callable $fn
*/
public function forEachNodeTopDown(callable $fn);
/**
* Set arguments to be passed to the test definition when invoked.
*
* @param array $args
* @return mixed
*/
public function setDefinitionArguments(array $args);
/**
* Return an array of arguments to be passed to the test definition when invoked.
*
* @return array
*/
public function getDefinitionArguments();
}