Skip to content

Commit 3a1e049

Browse files
committed
search a keyword in csv file
Signed-off-by: rahul <rcsofttech85@gmail.com>
1 parent d51a095 commit 3a1e049

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/FileHandlerTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ public function movie_is_found_for_exact_name_match(string $keyword)
101101
$this->assertTrue($isMovieAvailable);
102102
}
103103

104+
#[Test]
105+
#[DataProvider('provide_studio_names')]
106+
#[TestDox('Studio with name $keyword exists in collection.')]
107+
public function studio_is_found_for_exact_name_match(string $keyword)
108+
{
109+
$isStudioFound = $this->fileHandler->open(filename: 'movie.csv')->searchInCsvFile(keyword: $keyword, offset: 2);
110+
$this->assertTrue($isStudioFound);
111+
}
112+
104113
#[Test]
105114
public function should_throw_exception_if_not_valid_csv()
106115
{
@@ -109,6 +118,13 @@ public function should_throw_exception_if_not_valid_csv()
109118
$this->fileHandler->open(filename: 'invalid.csv')->searchInCsvFile(keyword: 'hello');
110119
}
111120

121+
public static function provide_studio_names(): iterable
122+
{
123+
yield ["Fox"];
124+
yield ["Universal"];
125+
yield ["Warner Bros."];
126+
}
127+
112128

113129
public static function provide_movie_names(): iterable
114130
{

0 commit comments

Comments
 (0)