File tree Expand file tree Collapse file tree 11 files changed +53
-5
lines changed Expand file tree Collapse file tree 11 files changed +53
-5
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ public function toString(): string
3030 */
3131 protected function matches ($ other ): bool
3232 {
33+ if (!$ other instanceof ProbeInterface) {
34+ return false ;
35+ }
36+
3337 return $ this ->expectedCount === $ other ->getExecutedTasks ();
3438 }
3539}
Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ public function toString(): string
3030 */
3131 protected function matches ($ other ): bool
3232 {
33+ if (!$ other instanceof ProbeInterface) {
34+ return false ;
35+ }
36+
3337 return $ this ->expectedCount === $ other ->getFailedTasks ();
3438 }
3539}
Original file line number Diff line number Diff line change 66
77use PHPUnit \Framework \Constraint \Constraint ;
88use SchedulerBundle \Probe \ProbeInterface ;
9+ use SchedulerBundle \SchedulerInterface ;
10+ use Throwable ;
911use function sprintf ;
1012
1113/**
@@ -27,9 +29,15 @@ public function toString(): string
2729
2830 /**
2931 * @param mixed|ProbeInterface $other
32+ *
33+ * @throws Throwable {@see SchedulerInterface::getTasks()}
3034 */
3135 protected function matches ($ other ): bool
3236 {
37+ if (!$ other instanceof ProbeInterface) {
38+ return false ;
39+ }
40+
3341 return $ this ->expectedCount === $ other ->getScheduledTasks ();
3442 }
3543}
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ public function toString(): string
3434 */
3535 protected function matches ($ other ): bool
3636 {
37+ if (!$ other instanceof ProbeInterface) {
38+ return false ;
39+ }
40+
3741 return $ this ->expectedState === [
3842 'executedTasks ' => $ other ->getExecutedTasks (),
3943 'failedTasks ' => $ other ->getFailedTasks (),
Original file line number Diff line number Diff line change 66
77use PHPUnit \Framework \Constraint \Constraint ;
88use SchedulerBundle \SchedulerInterface ;
9+ use Throwable ;
910use function sprintf ;
1011
1112/**
@@ -27,9 +28,15 @@ public function toString(): string
2728
2829 /**
2930 * @param mixed|SchedulerInterface $other
31+ *
32+ * @throws Throwable {@see SchedulerInterface::getDueTasks()}
3033 */
3134 protected function matches ($ other ): bool
3235 {
36+ if (!$ other instanceof SchedulerInterface) {
37+ return false ;
38+ }
39+
3340 return $ this ->expectedCount === $ other ->getDueTasks ()->count ();
3441 }
3542}
Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ public function toString(): string
3232 */
3333 protected function matches ($ other ): bool
3434 {
35+ if (!$ other instanceof TaskEventList) {
36+ return false ;
37+ }
38+
3539 return $ this ->expectedCount === $ this ->countExecutedTasks ($ other );
3640 }
3741
Original file line number Diff line number Diff line change 77use PHPUnit \Framework \Constraint \Constraint ;
88use SchedulerBundle \Event \TaskEventList ;
99use function count ;
10- use function is_countable ;
1110use function sprintf ;
1211
1312/**
@@ -32,6 +31,10 @@ public function toString(): string
3231 */
3332 protected function matches ($ other ): bool
3433 {
35- return $ this ->expectedCount === (is_countable ($ other ->getFailedTaskEvents ()) ? count ($ other ->getFailedTaskEvents ()) : 0 );
34+ if (!$ other instanceof TaskEventList) {
35+ return false ;
36+ }
37+
38+ return $ this ->expectedCount === count ($ other ->getFailedTaskEvents ());
3639 }
3740}
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ public function toString(): string
3131 */
3232 protected function matches ($ other ): bool
3333 {
34+ if (!$ other instanceof TaskEventList) {
35+ return false ;
36+ }
37+
3438 return $ this ->expectedCount === $ this ->countQueuedTasks ($ other );
3539 }
3640
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ public function toString(): string
3131 */
3232 protected function matches ($ other ): bool
3333 {
34- return $ this ->expectedCount === (is_countable ($ other ->getScheduledTaskEvents ()) ? count ($ other ->getScheduledTaskEvents ()) : 0 );
34+ if (!$ other instanceof TaskEventList) {
35+ return false ;
36+ }
37+
38+ return $ this ->expectedCount === count ($ other ->getScheduledTaskEvents ());
3539 }
3640}
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ public function toString(): string
3131 */
3232 protected function matches ($ other ): bool
3333 {
34- return $ this ->expectedCount === (is_countable ($ other ->getUnscheduledTaskEvents ()) ? count ($ other ->getUnscheduledTaskEvents ()) : 0 );
34+ if (!$ other instanceof TaskEventList) {
35+ return false ;
36+ }
37+
38+ return $ this ->expectedCount === count ($ other ->getUnscheduledTaskEvents ());
3539 }
3640}
You can’t perform that action at this time.
0 commit comments