From 2dcf9535cb8b8bb15db80e3e2b584cb7e88081c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 17 Nov 2016 10:29:49 +0100 Subject: [PATCH] Add test for search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- tests/ShapeFileTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/ShapeFileTest.php b/tests/ShapeFileTest.php index d26a14d..658b444 100644 --- a/tests/ShapeFileTest.php +++ b/tests/ShapeFileTest.php @@ -378,4 +378,21 @@ public function shapes() ), ); } + + public function testSearch() + { + $shp = new ShapeFile(0); + $shp->loadFromFile('data/capitals.*'); + /* Nonexisting entry or no dbase support */ + $this->assertEquals( + -1, + $shp->getIndexFromDBFData('CNTRY_NAME', 'nonexisting') + ); + if (ShapeFile::supports_dbase()) { + $this->assertEquals( + 218, + $shp->getIndexFromDBFData('CNTRY_NAME', 'Czech Republic') + ); + } + } }