From ce4da6913ad212362c93625dc4920495ad0285a0 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 5 Mar 2015 15:41:45 +0800 Subject: [PATCH 1/1] DO NOT COMMIT - Tests for MDL-48065 --- 48065.php | 5 +++++ 48065lib.php | 8 ++++++++ lib/tests/48065.php | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 48065.php create mode 100644 48065lib.php create mode 100644 lib/tests/48065.php diff --git a/48065.php b/48065.php new file mode 100644 index 0000000..578d764 --- /dev/null +++ b/48065.php @@ -0,0 +1,5 @@ +dirroot . '/48065lib.php'); +test_lock_autorelease(); diff --git a/48065lib.php b/48065lib.php new file mode 100644 index 0000000..bbc330e --- /dev/null +++ b/48065lib.php @@ -0,0 +1,8 @@ +get_lock('somelock', 10); +} diff --git a/lib/tests/48065.php b/lib/tests/48065.php new file mode 100644 index 0000000..c66bc2d --- /dev/null +++ b/lib/tests/48065.php @@ -0,0 +1,18 @@ +dirroot . '/48065lib.php'); + +class mdl_48065_test extends advanced_testcase { + + public function test_lock_autorelease() { + $this->setExpectedException('coding_exception', + 'Coding error detected, it must be fixed by a programmer: ' . + '\core\lock\lock() has fallen out of scope without being released.' . + "\n" . + 'Locks must ALWAYS be released by calling $mylock->release().'); + $this->resetAfterTest(true); + test_lock_autorelease(); + } +} -- 2.2.1