File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -369,6 +369,34 @@ public function testDbase7double(): void
369369 self ::assertSame (0.0 , $ table ->nextRecord ()->get ('double ' ));
370370 }
371371
372+ public function testColumnsOptions (): void
373+ {
374+ $ table = new TableReader (__DIR__ .'/Resources/dBase/dBaseVII.dbf ' , [
375+ 'columns ' => ['name ' , 'money ' ],
376+ ]);
377+
378+ self ::assertCount (2 , $ table ->getColumns ());
379+
380+ $ record = $ table ->nextRecord ();
381+ self ::assertSame ('Groot ' , $ record ->get ('name ' ));
382+ self ::assertSame (12.1235 , $ record ->get ('money ' ));
383+ }
384+
385+ /**
386+ * You cannot get data from unspecified columns.
387+ */
388+ public function testColumnsOptionsFail (): void
389+ {
390+ self ::expectException (\Exception::class);
391+
392+ $ table = new TableReader (__DIR__ .'/Resources/dBase/dBaseVII.dbf ' , [
393+ 'columns ' => ['name ' , 'money ' ],
394+ ]);
395+
396+ $ record = $ table ->nextRecord ();
397+ self ::assertSame ('Groot ' , $ record ->get ('bio ' ));
398+ }
399+
372400 protected function assertMemoImg (TableReader $ table )
373401 {
374402 $ record = $ table ->moveTo (1 );
You can’t perform that action at this time.
0 commit comments