Skip to content

Commit 148b8f6

Browse files
committed
- added some @Depends annotations in tests/Versioning/VersionHistoryTest.php
- fixed some code formating issues
1 parent ba0926a commit 148b8f6

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

tests/Versioning/VersionHistoryTest.php

+25-21
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ public function testGetAllLinearVersions()
125125
$this->assertCount(1, $lastVersion->getPredecessors());
126126
$this->assertCount(0, $lastVersion->getSuccessors());
127127
}
128-
129128
public function testGetAllVersions()
130129
{
131130
// TODO: have non linear version history
@@ -150,7 +149,6 @@ public function testGetAllVersions()
150149
$this->assertCount(1, $lastVersion->getPredecessors());
151150
$this->assertCount(0, $lastVersion->getSuccessors());
152151
}
153-
154152
/**
155153
* Check version history (allVersions), add more versions, then check the history updates correctly.
156154
*/
@@ -312,24 +310,9 @@ public function testDeleteUnexistingVersion()
312310
$history->removeVersion('unexisting');
313311
}
314312

315-
/**
316-
* Load Version by label
317-
*/
318-
public function testGetVersionByLabel()
319-
{
320-
$history = $this->vm->getVersionHistory('/tests_version_base/versioned');
321-
$history->addVersionLabel('1.0', 'stable', false);
322-
323-
$expectedVersion = $history->getVersion('1.0');
324-
$actualVersion = $history->getVersionByLabel('stable');
325-
326-
$this->assertEquals($expectedVersion->getIdentifier(), $actualVersion->getIdentifier());
327-
}
328-
329-
330313
/**
331314
* Try to load Version by unexisting label
332-
* @expectedException PHPCR\Version\VersionException
315+
* @expectedException \PHPCR\Version\VersionException
333316
*/
334317
public function testUnexistingGetVersionByLabel()
335318
{
@@ -345,6 +328,8 @@ public function testAddLabel()
345328
{
346329
$history = $this->vm->getVersionHistory('/tests_version_base/versioned');
347330
$history->addVersionLabel('1.0', 'stable', false);
331+
$history->setChildrenDirty();
332+
348333
$node = $history->getNode('jcr:versionLabels');
349334
try {
350335
$property = $node->getProperty('stable');
@@ -353,8 +338,26 @@ public function testAddLabel()
353338
}
354339
}
355340

341+
/**
342+
* Load Version by label
343+
*
344+
* @depends testAddLabel
345+
*/
346+
public function testGetVersionByLabel()
347+
{
348+
$history = $this->vm->getVersionHistory('/tests_version_base/versioned');
349+
$history->addVersionLabel('1.0', 'stable', false);
350+
351+
$expectedVersion = $history->getVersion('1.0');
352+
$actualVersion = $history->getVersionByLabel('stable');
353+
354+
$this->assertEquals($expectedVersion->getIdentifier(), $actualVersion->getIdentifier());
355+
}
356+
356357
/**
357358
* Try to check, if version has label
359+
*
360+
* @depends testAddLabel
358361
*/
359362
public function testHasVersionLabel()
360363
{
@@ -365,7 +368,6 @@ public function testHasVersionLabel()
365368

366369
$version = $history->getVersion('1.0');
367370

368-
369371
$this->assertFalse($history->hasVersionLabel('unsetlabel'));
370372
$this->assertFalse($history->hasVersionLabel('unsetlabel', $version));
371373

@@ -378,6 +380,8 @@ public function testHasVersionLabel()
378380

379381
/**
380382
* Try to get labels from version history
383+
*
384+
* @depends testAddLabel
381385
*/
382386
public function testGetVersionLabels()
383387
{
@@ -402,6 +406,8 @@ public function testGetVersionLabels()
402406

403407
/**
404408
* removes label from a version
409+
*
410+
* @depends testAddLabel
405411
*/
406412
public function testRemoveLabel()
407413
{
@@ -413,7 +419,6 @@ public function testRemoveLabel()
413419
$this->assertFalse($history->hasVersionLabel('toremove'));
414420
}
415421

416-
417422
/**
418423
* Try to remove unset label from a version.
419424
* @expectedException \PHPCR\Version\VersionException
@@ -424,7 +429,6 @@ public function testRemoveUnsetLabel()
424429
$history->removeVersionLabel('unsetLabel');
425430
}
426431

427-
428432
/**
429433
* Check if a version node with the given name exists in the version history.
430434
*

0 commit comments

Comments
 (0)