4
4
5
5
namespace Arkitect \Tests \Unit \Expressions \ForClasses ;
6
6
7
- use Arkitect \Analyzer \ClassDescription ;
8
- use Arkitect \Analyzer \FullyQualifiedClassName ;
7
+ use Arkitect \Analyzer \ClassDescriptionBuilder ;
9
8
use Arkitect \Expression \ForClasses \ContainDocBlockLike ;
10
9
use Arkitect \Rules \Violations ;
11
10
use PHPUnit \Framework \TestCase ;
@@ -16,19 +15,11 @@ public function test_it_should_return_true_if_contains_doc_block(): void
16
15
{
17
16
$ expression = new ContainDocBlockLike ('myDocBlock ' );
18
17
19
- $ classDescription = new ClassDescription (
20
- FullyQualifiedClassName::fromString ('HappyIsland\Myclass ' ),
21
- [],
22
- [],
23
- null ,
24
- false ,
25
- false ,
26
- false ,
27
- false ,
28
- false ,
29
- false ,
30
- ['/** */myDocBlock with other information ' ]
31
- );
18
+ $ classDescription = (new ClassDescriptionBuilder ())
19
+ ->setClassName ('HappyIsland\Myclass ' )
20
+ ->addDocBlock ('/** */myDocBlock with other information ' )
21
+ ->build ();
22
+
32
23
$ because = 'we want to add this rule for our software ' ;
33
24
$ violations = new Violations ();
34
25
$ expression ->evaluate ($ classDescription , $ violations , $ because );
@@ -40,50 +31,15 @@ public function test_it_should_return_true_if_contains_doc_block(): void
40
31
);
41
32
}
42
33
43
- public function test_it_should_return_true_if_contains_doc_block_without_because (): void
44
- {
45
- $ expression = new ContainDocBlockLike ('myDocBlock ' );
46
-
47
- $ classDescription = new ClassDescription (
48
- FullyQualifiedClassName::fromString ('HappyIsland\Myclass ' ),
49
- [],
50
- [],
51
- null ,
52
- false ,
53
- false ,
54
- false ,
55
- false ,
56
- false ,
57
- false ,
58
- ['/** */myDocBlock with other information ' ]
59
- );
60
- $ violations = new Violations ();
61
- $ expression ->evaluate ($ classDescription , $ violations , '' );
62
-
63
- self ::assertEquals (0 , $ violations ->count ());
64
- self ::assertEquals (
65
- 'should have a doc block that contains myDocBlock ' ,
66
- $ expression ->describe ($ classDescription , '' )->toString ()
67
- );
68
- }
69
-
70
34
public function test_it_should_return_false_if_not_contains_doc_block (): void
71
35
{
72
36
$ expression = new ContainDocBlockLike ('anotherDocBlock ' );
73
37
74
- $ classDescription = new ClassDescription (
75
- FullyQualifiedClassName::fromString ('HappyIsland\Myclass ' ),
76
- [],
77
- [],
78
- null ,
79
- false ,
80
- false ,
81
- false ,
82
- false ,
83
- false ,
84
- false ,
85
- ['/** */myDocBlock with other information ' ]
86
- );
38
+ $ classDescription = (new ClassDescriptionBuilder ())
39
+ ->setClassName ('HappyIsland\Myclass ' )
40
+ ->addDocBlock ('/** */myDocBlock with other information ' )
41
+ ->build ();
42
+
87
43
$ because = 'we want to add this rule for our software ' ;
88
44
$ violations = new Violations ();
89
45
$ expression ->evaluate ($ classDescription , $ violations , $ because );
0 commit comments