@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class DiffusionPathQueryTestCase extends PhabricatorTestCase {
4
5 public function testParentEdgeCases() {
6 $this->assertEqual(
7 '/',
8 DiffusionPathIDQuery::getParentPath('/'),
9 pht('Parent of %s', '/'));
10 $this->assertEqual(
11 '/',
12 DiffusionPathIDQuery::getParentPath('x.txt'),
13 pht('Parent of %s', 'x.txt'));
14 $this->assertEqual(
15 '/a',
16 DiffusionPathIDQuery::getParentPath('/a/b'),
17 pht('Parent of %s', '/a/b'));
18 $this->assertEqual(
19 '/a',
20 DiffusionPathIDQuery::getParentPath('/a///b'),
21 pht('Parent of %s', '/a///b'));
22 }
23
24 public function testExpandEdgeCases() {
25 $this->assertEqual(
26 array('/'),
27 DiffusionPathIDQuery::expandPathToRoot('/'));
28 $this->assertEqual(
29 array('/'),
30 DiffusionPathIDQuery::expandPathToRoot('//'));
31 $this->assertEqual(
32 array('/a/b', '/a', '/'),
33 DiffusionPathIDQuery::expandPathToRoot('/a/b'));
34 $this->assertEqual(
35 array('/a/b', '/a', '/'),
36 DiffusionPathIDQuery::expandPathToRoot('/a//b'));
37 $this->assertEqual(
38 array('/a/b', '/a', '/'),
39 DiffusionPathIDQuery::expandPathToRoot('a/b'));
40 }
41
42}