TestSuite::collect PHP Méthode

collect() public méthode

Delegates to a visiting collector to add test files.
public collect ( string $path, SimpleCollector $collector )
$path string Path to scan from.
$collector SimpleCollector Directory scanner.
    public function collect($path, $collector)
    {
        $collector->collect($this, $path);
    }

Usage Example

Exemple #1
0
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# load required files
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
require_once 'simpletest/collector.php';
require_once 'simpletest/mock_objects.php';
require_once 'varstream.php';
$project_path = dirname(dirname(__FILE__));
$lib_path = $project_path . '/lib/src/';
# load required files
require_once $lib_path . 'dispatcher.php';
require_once $lib_path . 'response.php';
require_once $lib_path . 'controller.php';
require_once $lib_path . 'inflector.php';
require_once $lib_path . 'flash.php';
require_once $lib_path . 'exception.php';
# load flexi lib
require_once $project_path . '/vendor/flexi/flexi.php';
# load all mocks
require_once 'lib/mocks.php';
# collect all tests
$all = new TestSuite('All tests');
$all->collect(dirname(__FILE__) . '/lib', new SimplePatternCollector('/test.php$/'));
# use text reporter if cli
if (sizeof($_SERVER['argv'])) {
    $all->run(new TextReporter());
} else {
    $all->run(new HtmlReporter());
}