@@ -32,7 +32,6 @@ protected function tearDown(): void
3232
3333
3434 #[Test]
35- #[TestDox("file was written successfully! " )]
3635 public function file_successfully_written ()
3736 {
3837 $ this ->fileHandler ->open (filename: 'file ' );
@@ -43,7 +42,6 @@ public function file_successfully_written()
4342 }
4443
4544 #[Test]
46- #[TestDox("should throw an exception if file is not found " )]
4745 public function should_throw_exception_if_file_is_not_Found ()
4846 {
4947 $ this ->expectException (FileNotFoundException::class);
@@ -52,7 +50,6 @@ public function should_throw_exception_if_file_is_not_Found()
5250 }
5351
5452 #[Test]
55- #[TestDox("should throw an exception if file is not writable " )]
5653 public function should_throw_exception_if_file_is_not_writable ()
5754 {
5855 $ this ->fileHandler ->open (filename: 'file ' , mode: 'r ' );
@@ -63,7 +60,6 @@ public function should_throw_exception_if_file_is_not_writable()
6360 }
6461
6562 #[Test]
66- #[TestDox("multiple files can be written simultaneously " )]
6763 public function multiple_file_can_be_written_simultaneously ()
6864 {
6965 $ this ->fileHandler ->open (filename: 'file ' );
@@ -81,7 +77,6 @@ public function multiple_file_can_be_written_simultaneously()
8177
8278
8379 #[Test]
84- #[TestDox("checks if a movie exists in a collection by a name " )]
8580 public function file_is_closed_properly ()
8681 {
8782 $ this ->fileHandler ->open (filename: 'file ' );
@@ -114,10 +109,30 @@ public function studio_is_found_for_exact_name_match(string $keyword)
114109 public function should_throw_exception_if_not_valid_csv ()
115110 {
116111 $ this ->expectException (InvalidFileException::class);
117- $ this ->expectExceptionMessage ("invalid file format " );
112+ $ this ->expectExceptionMessage ("not a valid csv file " );
118113 $ this ->fileHandler ->open (filename: 'invalid.csv ' )->searchInCsvFile (keyword: 'hello ' );
119114 }
120115
116+ #[Test]
117+ public function to_array_method_returns_valid_array ()
118+ {
119+ $ data = $ this ->fileHandler ->open (filename: 'movie.csv ' )->toArray ();
120+
121+ $ expected = [
122+ 'Film ' => 'Zack and Miri Make a Porno ' ,
123+ 'Genre ' => 'Romance ' ,
124+ 'Lead Studio ' => 'The Weinstein Company ' ,
125+ 'Audience score % ' => '70 ' ,
126+ 'Profitability ' => '1.747541667 ' ,
127+ 'Rotten Tomatoes % ' => '64 ' ,
128+ 'Worldwide Gross ' => '$41.94 ' ,
129+ 'Year ' => '2008 '
130+
131+ ];
132+
133+ $ this ->assertEquals ($ expected , $ data [0 ]);
134+ }
135+
121136 public static function provide_studio_names (): iterable
122137 {
123138 yield ["Fox " ];
0 commit comments