From 311fd62d9527a47586d90a6f4e2c80922d15d44f Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 19 Oct 2018 18:11:15 +0200 Subject: [PATCH 1/2] FIX getExtensionInstance can return null, add a case to handle that --- src/Core/Extensible.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Core/Extensible.php b/src/Core/Extensible.php index de40620b6..b29dda32e 100644 --- a/src/Core/Extensible.php +++ b/src/Core/Extensible.php @@ -135,6 +135,10 @@ trait Extensible $this->addCallbackMethod($method, function ($inst, $args) use ($method, $extensionClass) { /** @var Extensible $inst */ $extension = $inst->getExtensionInstance($extensionClass); + if (!$extension) { + return null; + } + try { $extension->setOwner($inst); return call_user_func_array([$extension, $method], $args); From 7f6f5c9ec9352172f37f8980d823e85c1c39062a Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Sat, 20 Oct 2018 13:59:03 +0200 Subject: [PATCH 2/2] FIX Flush extra methods cache on DataObjects after each unit test class has finished --- src/Dev/State/ExtensionTestState.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Dev/State/ExtensionTestState.php b/src/Dev/State/ExtensionTestState.php index ea0859915..2cfedddbd 100644 --- a/src/Dev/State/ExtensionTestState.php +++ b/src/Dev/State/ExtensionTestState.php @@ -85,5 +85,6 @@ class ExtensionTestState implements TestState public function tearDownOnce($class) { + DataObject::flush_extra_methods_cache(); } }