mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
24 lines
775 B
PHP
24 lines
775 B
PHP
|
<?php
|
||
|
namespace Framadate;
|
||
|
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
|
||
|
abstract class FramaTestCase extends TestCase {
|
||
|
protected function getTestResourcePath($resourcepath) {
|
||
|
return __DIR__ . '/../resources/' . $resourcepath;
|
||
|
}
|
||
|
|
||
|
protected function readTestResource($resourcepath) {
|
||
|
return file_get_contents($this->getTestResourcePath($resourcepath));
|
||
|
}
|
||
|
|
||
|
protected function invoke(&$object, $methodName) {
|
||
|
$reflectionClass = new \ReflectionClass($object);
|
||
|
$reflectionMethod = $reflectionClass->getMethod($methodName);
|
||
|
$reflectionMethod->setAccessible(true);
|
||
|
|
||
|
$params = array_slice(func_get_args(), 2); // get all the parameters after $methodName
|
||
|
return $reflectionMethod->invokeArgs($object, $params);
|
||
|
}
|
||
|
}
|