-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStructTest.php
61 lines (49 loc) · 1.4 KB
/
StructTest.php
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
use GoBrave\PostExtender\Struct;
class StructTest extends PHPUnit_Framework_TestCase
{
public function setUp() {
$this->s = new Struct(__DIR__ . '/data/page.json');
$this->f = new Struct(__DIR__ . '/data/failure.json');
}
public function testStruct() {
$struct = new Struct(__DIR__ . '/data/page.json');
}
/**
* @expectedException Exception
*/
public function testMissingFile() {
$struct = new Struct(__DIR__ . '/asd.json');
}
/**
* @expectedException Exception
*/
public function testBadFormatFile() {
$struct = new Struct(__DIR__ . '/data/format.json');
}
public function testParent() {
$this->assertSame($this->s->parent(), 'ui_category');
$this->assertFalse($this->f->parent());
}
public function testHasPage() {
$this->assertSame($this->s->hasPage(), true);
$this->assertFalse($this->f->hasPage());
}
public function testSingle() {
$this->assertSame($this->s->single(), true);
$this->assertFalse($this->f->single());
}
public function testRewrite() {
$this->assertSame($this->s->rewrite(), 'sida');
$this->assertFalse($this->f->rewrite());
}
public function testName() {
$this->assertSame($this->s->name(), 'page');
}
public function testSingular() {
$this->assertSame($this->s->singular(), 'Sida');
}
public function testPlural() {
$this->assertSame($this->s->plural(), 'Sidor');
}
}