From 120b5190c69a78192ec1372f5da151ecc429ecc5 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Sat, 2 Dec 2023 11:14:41 +0100 Subject: [PATCH] fix another undefined property --- .../Versioning/CreateVersionableNodeTest.php | 6 +++++ tests/Versioning/VersionManagerTest.php | 24 +++++++++---------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tests/Versioning/CreateVersionableNodeTest.php b/tests/Versioning/CreateVersionableNodeTest.php index 7bf455be..5ee95be7 100644 --- a/tests/Versioning/CreateVersionableNodeTest.php +++ b/tests/Versioning/CreateVersionableNodeTest.php @@ -12,6 +12,7 @@ namespace PHPCR\Tests\Versioning; use PHPCR\Test\BaseCase; +use PHPCR\Version\VersionManagerInterface; /** * Testing whether mix:versionable node type is properly handled. @@ -20,6 +21,11 @@ */ class CreateVersionableNodeTest extends BaseCase { + /** + * @var VersionManagerInterface + */ + private $vm; + public static function setupBeforeClass($fixtures = '15_Versioning/base'): void { parent::setupBeforeClass($fixtures); diff --git a/tests/Versioning/VersionManagerTest.php b/tests/Versioning/VersionManagerTest.php index 7658e1a1..14e09804 100644 --- a/tests/Versioning/VersionManagerTest.php +++ b/tests/Versioning/VersionManagerTest.php @@ -447,20 +447,18 @@ public function testRestoreNonexistingName() $this->vm->restore(true, 'not-existing', '/tests_version_base/versioned'); } - public function testRestoreNonsenseArguments() + public function testRestoreNoPath() { - try { - $this->vm->restore(true, 'something'); - $this->fail('restoring with version name and no path should throw an exception'); - } catch (Exception $e) { - // we expect something to be thrown - } - try { - $this->vm->restore(true, $this); - $this->fail('restoring with non-version object'); - } catch (Exception $e) { - // we expect something to be thrown - } + $this->expectException(\Exception::class); + + $this->vm->restore(true, 'something'); + } + + public function testRestoreInvalidType() + { + $this->expectException(\Exception::class); + + $this->vm->restore(true, $this); } public function testRestoreRootVersion()