forked from hhvm/user-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPINavDataTest.php
More file actions
45 lines (39 loc) · 1.3 KB
/
Copy pathAPINavDataTest.php
File metadata and controls
45 lines (39 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?hh // strict
namespace HHVM\UserDocumentation\Tests;
use function Facebook\FBExpect\expect;
use type HHVM\UserDocumentation\{APINavData, APIProduct, NavDataNode};
/**
* @small
*/
class APINavDataTest extends \Facebook\HackTest\HackTest {
public function testNamespacedDefinitionName(): void {
$classes = APINavData::get(APIProduct::HACK)
->getNavData()['Classes']['children'];
$have_ns_separator = false;
foreach ($classes as $node) {
/* HH_FIXME[4110] need reified/enforceable */
$node = (($x): NavDataNode ==> $x)($node);
if (\strpos($node['name'], "HH\\") === 0) {
$have_ns_separator = true;
break;
}
}
expect($have_ns_separator)->toBeTrue();
}
public function testNamespacedDefinitionURL(): void {
$classes = APINavData::get(APIProduct::HACK)
->getNavData()['Classes']['children'];
$have_ns_separator = false;
foreach ($classes as $node) {
/* HH_FIXME[4110] need reified/enforceable */
$node = (($x): NavDataNode ==> $x)($node);
if (\strpos($node['name'], "HH\\") === 0) {
$have_ns_separator = true;
$url_pattern = \strtr($node['name'], "\\", '.');
expect($node['urlPath'])->toContainSubstring($url_pattern);
break;
}
}
expect($have_ns_separator)->toBeTrue();
}
}