From 119b9ad0a78c4325f450211d0a935788f907e724 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 19 Feb 2018 15:33:08 +0100 Subject: [PATCH] tests: added test for extension methods --- tests/Forms/BaseControl.extensionMethod.phpt | 36 ++++++++++++++++++++ tests/Forms/Container.extensionMethod.phpt | 18 ++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/Forms/BaseControl.extensionMethod.phpt create mode 100644 tests/Forms/Container.extensionMethod.phpt diff --git a/tests/Forms/BaseControl.extensionMethod.phpt b/tests/Forms/BaseControl.extensionMethod.phpt new file mode 100644 index 000000000..1cedbbc4f --- /dev/null +++ b/tests/Forms/BaseControl.extensionMethod.phpt @@ -0,0 +1,36 @@ +test(1, 2)); + +$control2 = new Checkbox; +Assert::same('Checkbox', $control2->test(1, 2)); + +Assert::exception(function () { + $control3 = new Button; + $control3->test(1, 2); +}, Nette\MemberAccessException::class); diff --git a/tests/Forms/Container.extensionMethod.phpt b/tests/Forms/Container.extensionMethod.phpt new file mode 100644 index 000000000..a0bfcc97d --- /dev/null +++ b/tests/Forms/Container.extensionMethod.phpt @@ -0,0 +1,18 @@ +test(1, 2));