File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ public function findById($id)
70
70
{
71
71
$ result = $ this ->_adapter ->find ($ id );
72
72
if (0 == count ($ result )) {
73
- return ;
73
+ throw new \ InvalidArgumentException ( " User # $ id not found " ) ;
74
74
}
75
75
$ row = $ result ->current ();
76
76
Original file line number Diff line number Diff line change @@ -87,4 +87,18 @@ public function testRestoreMulti(User $existing)
87
87
$ this ->assertEquals ([$ existing ], $ user );
88
88
}
89
89
90
- }
90
+ /**
91
+ * @expectedException InvalidArgumentException
92
+ * @expectedExceptionMessage User #404 not found
93
+ */
94
+ public function testNotFound ()
95
+ {
96
+ $ this ->dbal ->expects ($ this ->once ())
97
+ ->method ('find ' )
98
+ ->with (404 )
99
+ ->will ($ this ->returnValue ([]));
100
+
101
+ $ user = $ this ->mapper ->findById (404 );
102
+ }
103
+
104
+ }
You can’t perform that action at this time.
0 commit comments