public function setUp() { parent::setUp(); $this->vm = $this->session->getWorkspace()->getVersionManager(); $this->simpleVersioned = $this->vm->getBaseVersion('/tests_version_base/simpleVersioned'); $this->assertInstanceOf('PHPCR\\Version\\VersionInterface', $this->simpleVersioned); }
/** * Check version history (allLinearVersions), add more versions, then check the history updates correctly. */ public function testMixingCreateAndGetAllLinearVersions() { $vm = $this->session->getWorkspace()->getVersionManager(); $baseNode = $this->session->getNode('/tests_version_base'); $node = $baseNode->addNode('versioned_all_linear', 'nt:unstructured'); $node->addMixin('mix:versionable'); $node->setProperty('foo', 'bar'); $this->session->save(); $history = $vm->getVersionHistory('/tests_version_base/versioned_all_linear'); $this->assertCount(1, $history->getAllLinearVersions()); $vm->checkpoint('/tests_version_base/versioned_all_linear'); $node->setProperty('foo', 'bar2'); $this->session->save(); $this->assertCount(2, $history->getAllLinearVersions()); $vm->checkin('/tests_version_base/versioned_all_linear'); $this->assertCount(3, $history->getAllLinearVersions()); $finalVersions = $history->getAllLinearVersions(); $firstVersion = $finalVersions->current(); $lastVersion = null; foreach ($finalVersions as $name => $version) { $this->assertInstanceOf('PHPCR\\Version\\VersionInterface', $version); $this->assertEquals($version->getName(), $name); $lastVersion = $version; } $currentVersion = $this->vm->getBaseVersion('/tests_version_base/versioned_all_linear'); $this->assertSame($currentVersion, $lastVersion); $this->assertCount(0, $firstVersion->getPredecessors()); $this->assertCount(1, $firstVersion->getSuccessors()); $this->assertCount(1, $lastVersion->getPredecessors()); $this->assertCount(0, $lastVersion->getSuccessors()); }
/** * @expectedException \PHPCR\RepositoryException */ public function testGetBaseVersionNotfound() { $version = $this->vm->getBaseVersion('/tests_version_base/not_existing'); }