Skip to content

Commit

Permalink
phpunit 8
Browse files Browse the repository at this point in the history
  • Loading branch information
nticaric committed Feb 11, 2019
1 parent 8a2cc59 commit b8cd65f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ examples
.DS_Store
composer.lock
coverage
tests/_files/*.index
tests/_files/*.index
.phpunit.result.cache
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ php:
- 7.2
- 7.3
- 7.4snapshot
- nightly

addons:
code_climate:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "7.*"
"phpunit/phpunit": "8.*"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 7 additions & 0 deletions tests/TNTGeoSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,11 @@ public function testFindNearest()
$this->assertEquals([9389, 9407], $cities['ids']);
$this->assertEquals(2, $cities['hits']);
}

public function tearDown(): void
{
if (file_exists(__DIR__.'/../_files/'.$this->indexName)) {
unlink(__DIR__.'/../_files/'.$this->indexName);
}
}
}
8 changes: 3 additions & 5 deletions tests/TNTSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,10 @@ public function testFuzzySearchMultipleWordsFound()
$this->assertContains(15, $res['ids']);
}

/**
* @expectedException TeamTNT\TNTSearch\Exceptions\IndexNotFoundException
* @expectedExceptionCode 1
*/
public function testIndexDoesNotExistException()
{
$this->expectException(IndexNotFoundException::class);
$this->expectExceptionCode(1);
$tnt = new TNTSearch;
$tnt->loadConfig($this->config);
$tnt->selectIndex('IndexThatDoesNotExist');
Expand Down Expand Up @@ -334,7 +332,7 @@ public function testDefaultStemmerIsSetOnNewIndexesIfNoneConfigured()
$this->assertInstanceOf(\TeamTNT\TNTSearch\Stemmer\PorterStemmer::class, $tnt->getStemmer());
}

public function tearDown()
public function tearDown(): void
{
if (file_exists(__DIR__."/".$this->indexName)) {
unlink(__DIR__."/".$this->indexName);
Expand Down
7 changes: 0 additions & 7 deletions tests/indexer/TNTGeoIndexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,4 @@ public function testGeoIndexCreation()

$this->assertTrue(file_exists($indexPath));
}

public function tearDown()
{
if (file_exists(__DIR__.'/../_files/'.$this->indexName)) {
unlink(__DIR__.'/../_files/'.$this->indexName);
}
}
}
2 changes: 1 addition & 1 deletion tests/indexer/TNTIndexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function testBuildTrigrams()

}

public function tearDown()
public function tearDown(): void
{
if (file_exists(__DIR__.'/../_files/'.$this->indexName)) {
unlink(__DIR__.'/../_files/'.$this->indexName);
Expand Down
8 changes: 4 additions & 4 deletions tests/spell/JaroWinklerDistanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ public function __construct()
public function testJaro()
{
$d = $this->sd->jaro('DWAYNE', 'DUANE');
$this->assertEquals(0.822, $d, '', 0.001);
$this->assertEqualsWithDelta(0.822, $d, 0.001);

$d = $this->sd->jaro("MARTHA", "MARHTA");
$this->assertEquals(0.944444, $d, '', 0.001);
$this->assertEqualsWithDelta(0.944444, $d, 0.001);

$d = $this->sd->jaro("DIXON", "DICKSONX");
$this->assertEquals(0.766667, $d, '', 0.001);
$this->assertEqualsWithDelta(0.766667, $d, 0.001);

$d = $this->sd->jaro("JELLYFISH", "SMELLYFISH");
$this->assertEquals(0.896296, $d, '', 0.001);
$this->assertEqualsWithDelta(0.896296, $d, 0.001);
}

public function testGetDistance()
Expand Down

0 comments on commit b8cd65f

Please sign in to comment.