-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_model.php
103 lines (82 loc) · 3.14 KB
/
test_model.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php namespace Matura\Tests;
use Matura\Exceptions\Exception;
use Matura\Test\User;
use Matura\Test\Group;
/**
* Tests the construction of our test graph via our DSL.
*/
describe('Matura', function ($ctx) {
before(function ($ctx) {
// Officially, nesting suites in this manner is unsupported.
// A Suite block is automatically created for every test file.
$ctx->suite = suite('Suite', function () {
describe('Fixture', function ($ctx) {
it('TestMethod', function ($ctx) {
});
before(function ($ctx) {
});
before_all(function ($ctx) {
});
});
});
});
describe('Suite', function ($ctx) {
before(function ($ctx) {
$ctx->describe = $ctx->suite->find('Suite:Fixture');
});
it('should be a Suite Block', function ($ctx) {
expect($ctx->suite)->to->be->an('Matura\Blocks\Suite');
});
it('should have a name', function ($ctx) {
expect($ctx->suite->getName())->to->eql('Suite');
});
it('should have a path', function ($ctx) {
expect($ctx->suite->path())->to->eql('Suite');
});
it('should not have a parent Suite block', function ($ctx) {
expect($ctx->suite->parentBlock())->to->eql(null);
});
});
describe('Describe', function ($ctx) {
before(function ($ctx) {
$ctx->describe = $ctx->suite->find('Suite:Fixture');
});
it('should be a Describe Block', function ($ctx) {
expect($ctx->describe)->to->be->a('Matura\Blocks\Describe');
});
it('should have the correct parent Block', function ($ctx) {
expect($ctx->describe->parentBlock())->to->be($ctx->suite);
});
});
describe('TestMethod', function ($ctx) {
before(function ($ctx) {
$ctx->test = $ctx->suite->find('Suite:Fixture:TestMethod');
});
it('should be a TestMethod', function ($ctx) {
expect($ctx->test)->to->be->a('Matura\Blocks\Methods\TestMethod');
});
it('should have the correct parent Block', function ($ctx) {
expect($ctx->test->parentBlock())->to->be->a('Matura\Blocks\Describe');
});
});
describe('BeforeHook', function ($ctx) {
before(function ($ctx) {
$ctx->describe = $ctx->suite->find('Suite:Fixture');
});
it('should have 1 BeforeHook', function ($ctx) {
$befores = $ctx->describe->befores();
expect($befores)->to->have->length(1);
expect($befores[0])->to->be->a('Matura\Blocks\Methods\BeforeHook');
});
});
describe('BeforeAllHook', function ($ctx) {
before(function ($ctx) {
$ctx->describe = $ctx->suite->find('Suite:Fixture');
});
it('should have 1 BeforeAllHook', function ($ctx) {
$before_alls = $ctx->describe->beforeAlls();
expect($before_alls)->to->have->length(1);
expect($before_alls[0])->to->be->a('Matura\Blocks\Methods\BeforeAllHook');
});
});
});