File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public function addBook(Book $book)
25
25
26
26
public function removeBook (Book $ bookToRemove )
27
27
{
28
- foreach ($ this as $ key => $ book ) {
28
+ foreach ($ this -> books as $ key => $ book ) {
29
29
/** @var Book $book */
30
30
if ($ book ->getAuthorAndTitle () === $ bookToRemove ->getAuthorAndTitle ()) {
31
31
unset($ this ->books [$ key ]);
Original file line number Diff line number Diff line change @@ -63,4 +63,13 @@ public function testUseAReverseIteratorAndValidateAuthors($expected)
63
63
$ iterator ->next ();
64
64
}
65
65
}
66
+
67
+ /**
68
+ * Test BookList Remove
69
+ */
70
+ public function testBookRemove ()
71
+ {
72
+ $ this ->bookList ->removeBook ($ this ->bookList ->getBook (0 ));
73
+ $ this ->assertEquals ($ this ->bookList ->count (), 2 );
74
+ }
66
75
}
You can’t perform that action at this time.
0 commit comments