@@ -125,7 +125,6 @@ public function testGetAllLinearVersions()
125
125
$ this ->assertCount (1 , $ lastVersion ->getPredecessors ());
126
126
$ this ->assertCount (0 , $ lastVersion ->getSuccessors ());
127
127
}
128
-
129
128
public function testGetAllVersions ()
130
129
{
131
130
// TODO: have non linear version history
@@ -150,7 +149,6 @@ public function testGetAllVersions()
150
149
$ this ->assertCount (1 , $ lastVersion ->getPredecessors ());
151
150
$ this ->assertCount (0 , $ lastVersion ->getSuccessors ());
152
151
}
153
-
154
152
/**
155
153
* Check version history (allVersions), add more versions, then check the history updates correctly.
156
154
*/
@@ -312,24 +310,9 @@ public function testDeleteUnexistingVersion()
312
310
$ history ->removeVersion ('unexisting ' );
313
311
}
314
312
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
-
330
313
/**
331
314
* Try to load Version by unexisting label
332
- * @expectedException PHPCR\Version\VersionException
315
+ * @expectedException \ PHPCR\Version\VersionException
333
316
*/
334
317
public function testUnexistingGetVersionByLabel ()
335
318
{
@@ -345,6 +328,8 @@ public function testAddLabel()
345
328
{
346
329
$ history = $ this ->vm ->getVersionHistory ('/tests_version_base/versioned ' );
347
330
$ history ->addVersionLabel ('1.0 ' , 'stable ' , false );
331
+ $ history ->setChildrenDirty ();
332
+
348
333
$ node = $ history ->getNode ('jcr:versionLabels ' );
349
334
try {
350
335
$ property = $ node ->getProperty ('stable ' );
@@ -353,8 +338,26 @@ public function testAddLabel()
353
338
}
354
339
}
355
340
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
+
356
357
/**
357
358
* Try to check, if version has label
359
+ *
360
+ * @depends testAddLabel
358
361
*/
359
362
public function testHasVersionLabel ()
360
363
{
@@ -365,7 +368,6 @@ public function testHasVersionLabel()
365
368
366
369
$ version = $ history ->getVersion ('1.0 ' );
367
370
368
-
369
371
$ this ->assertFalse ($ history ->hasVersionLabel ('unsetlabel ' ));
370
372
$ this ->assertFalse ($ history ->hasVersionLabel ('unsetlabel ' , $ version ));
371
373
@@ -378,6 +380,8 @@ public function testHasVersionLabel()
378
380
379
381
/**
380
382
* Try to get labels from version history
383
+ *
384
+ * @depends testAddLabel
381
385
*/
382
386
public function testGetVersionLabels ()
383
387
{
@@ -402,6 +406,8 @@ public function testGetVersionLabels()
402
406
403
407
/**
404
408
* removes label from a version
409
+ *
410
+ * @depends testAddLabel
405
411
*/
406
412
public function testRemoveLabel ()
407
413
{
@@ -413,7 +419,6 @@ public function testRemoveLabel()
413
419
$ this ->assertFalse ($ history ->hasVersionLabel ('toremove ' ));
414
420
}
415
421
416
-
417
422
/**
418
423
* Try to remove unset label from a version.
419
424
* @expectedException \PHPCR\Version\VersionException
@@ -424,7 +429,6 @@ public function testRemoveUnsetLabel()
424
429
$ history ->removeVersionLabel ('unsetLabel ' );
425
430
}
426
431
427
-
428
432
/**
429
433
* Check if a version node with the given name exists in the version history.
430
434
*
0 commit comments