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()