@@ -30,12 +30,42 @@ function it_registers_a_class_with_a_condition()
30
30
{
31
31
$ this ->reset ();
32
32
33
- $ this ->register ('class1 ' , 'spec\Http\Discovery\ClassToFind ' , ' invalid ' );
33
+ $ this ->register ('class1 ' , 'spec\Http\Discovery\ClassToFind ' , false );
34
34
$ this ->register ('class2 ' , 'spec\Http\Discovery\AnotherClassToFind ' , 'spec\Http\Discovery\TestClass ' );
35
35
36
36
$ this ->find ()->shouldHaveType ('spec\Http\Discovery\AnotherClassToFind ' );
37
37
}
38
38
39
+ function it_registers_a_class_with_a_callable_condition ()
40
+ {
41
+ $ this ->reset ();
42
+
43
+ $ this ->register ('class1 ' , 'spec\Http\Discovery\ClassToFind ' , false );
44
+ $ this ->register ('class2 ' , 'spec\Http\Discovery\AnotherClassToFind ' , function () { return true ; });
45
+
46
+ $ this ->find ()->shouldHaveType ('spec\Http\Discovery\AnotherClassToFind ' );
47
+ }
48
+
49
+ function it_registers_a_class_with_a_boolean_condition ()
50
+ {
51
+ $ this ->reset ();
52
+
53
+ $ this ->register ('class1 ' , 'spec\Http\Discovery\ClassToFind ' , false );
54
+ $ this ->register ('class2 ' , 'spec\Http\Discovery\AnotherClassToFind ' , true );
55
+
56
+ $ this ->find ()->shouldHaveType ('spec\Http\Discovery\AnotherClassToFind ' );
57
+ }
58
+
59
+ function it_registers_a_class_with_an_invalid_condition ()
60
+ {
61
+ $ this ->reset ();
62
+
63
+ $ this ->register ('class1 ' , 'spec\Http\Discovery\ClassToFind ' , new \stdClass );
64
+ $ this ->register ('class2 ' , 'spec\Http\Discovery\AnotherClassToFind ' , true );
65
+
66
+ $ this ->find ()->shouldHaveType ('spec\Http\Discovery\AnotherClassToFind ' );
67
+ }
68
+
39
69
function it_resets_cache_when_a_class_is_registered ()
40
70
{
41
71
$ this ->reset ();
0 commit comments