File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1212abstract class BaseTestCase extends TestCase
1313{
1414
15+ /**
16+ * get method for test protected and private method
17+ *
18+ * usage:
19+ *
20+ * ```php
21+ * $rftMth = $this->method($className, $protectedOrPrivateMethod)
22+ *
23+ * $obj = new $className();
24+ * $res = $rftMth->invokeArgs($obj, $invokeArgs);
25+ * ```
26+ *
27+ * @param string|object $class
28+ * @param string $method
29+ *
30+ * @return ReflectionMethod
31+ * @throws ReflectionException
32+ */
33+ protected static function getMethod ($ class , string $ method ): ReflectionMethod
34+ {
35+ // $class = new \ReflectionClass($class);
36+ // $method = $class->getMethod($method);
37+
38+ $ method = new \ReflectionMethod ($ class , $ method );
39+ $ method ->setAccessible (true );
40+
41+ return $ method ;
42+ }
43+
1544 /**
1645 * @param callable $cb
1746 *
You can’t perform that action at this time.
0 commit comments