2015-05-29 17:05:26 +02:00
|
|
|
<?php
|
|
|
|
namespace Framadate;
|
|
|
|
|
2018-04-06 09:46:30 +02:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
abstract class FramaTestCase extends TestCase {
|
2021-12-20 17:46:50 +01:00
|
|
|
protected function getTestResourcePath(string $resourcepath): string
|
|
|
|
{
|
2018-02-19 00:18:43 +01:00
|
|
|
return __DIR__ . '/../resources/' . $resourcepath;
|
2015-05-29 17:05:26 +02:00
|
|
|
}
|
|
|
|
|
2021-12-20 17:46:50 +01:00
|
|
|
protected function readTestResource(string $resourcepath) {
|
2015-05-29 17:05:26 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|