Skip to content

Commit

Permalink
Update tests to account for removed Locator class
Browse files Browse the repository at this point in the history
  • Loading branch information
mallardduck committed May 4, 2018
1 parent 895b4dc commit 919da69
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Improved the flexibility of the WhoisServerList tests.
- Refactor AbstractClient and client to use the AbstractLocator and DomainLocator.
- Update AbstractClient property name - from tldLocator to whoisLocator - to better reflect usage.

- Refactor tests to use DomainLocator instead of removed Locator class.

### Added
- Create an AbstractLocator and DomainLocator for more flexibility!
Expand Down
1 change: 0 additions & 1 deletion tests/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace MallardDuck\Whois\Test;

use PHPUnit\Framework\TestCase;
use League\Uri\Components\Host;

/**
* Corresponding Class to test the whois Client class
Expand Down
18 changes: 9 additions & 9 deletions tests/WhoisLocatorExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace MallardDuck\Whois\Test;

use PHPUnit\Framework\TestCase;
use MallardDuck\Whois\WhoisServerList\Locator;
use MallardDuck\Whois\WhoisServerList\DomainLocator;
use MallardDuck\Whois\Exceptions\MissingArgException;
use MallardDuck\Whois\Exceptions\UnknownWhoisException;

Expand All @@ -24,7 +24,7 @@ public function testBlankStringThrowsException()
{
$this->expectException(MissingArgException::class);

$var = new Locator;
$var = new DomainLocator;
$results = $var->findWhoisServer('');
unset($var, $results);
}
Expand All @@ -34,7 +34,7 @@ public function testBlankStringThrowsException()
*/
public function testFindServerThenGetWhoisServerThenEmpty()
{
$var = new Locator;
$var = new DomainLocator;
$results = $var->findWhoisServer("com.com")->getWhoisServer();
$this->assertTrue(is_string($results) && !empty($results));
$this->assertTrue("whois.verisign-grs.com" === $results);
Expand All @@ -56,7 +56,7 @@ public function testNullStringThrowsException()
$this->expectException(\Exception::class);
}

$var = new Locator;
$var = new DomainLocator;
$results = $var->findWhoisServer(null);
unset($var, $results);
}
Expand All @@ -66,7 +66,7 @@ public function testNullStringThrowsException()
*/
public function testFindServerThenGetWhoisServerThenNull()
{
$var = new Locator;
$var = new DomainLocator;
$results = $var->findWhoisServer("com.com")->getWhoisServer();
$this->assertTrue(is_string($results) && !empty($results));
$this->assertTrue("whois.verisign-grs.com" === $results);
Expand All @@ -86,15 +86,15 @@ public function testFindServerThenGetWhoisServerThenNull()
*/
public function testGetWhoisServerDirect()
{
$var = new Locator;
$var = new DomainLocator;
$results = $var->getWhoisServer("bing.com");
$this->assertTrue(is_string($results) && !empty($results));
$this->assertTrue("whois.verisign-grs.com" === $results);
unset($var, $results);

$this->expectException(MissingArgException::class);

$var = new Locator;
$var = new DomainLocator;
$results = $var->getWhoisServer();
unset($var, $results);
}
Expand All @@ -104,7 +104,7 @@ public function testGetWhoisServerDirect()
*/
public function testGetWhoisServerDirectNoException()
{
$var = new Locator;
$var = new DomainLocator;
$results = $var->getWhoisServer("bing.com");
$orgResults = $results;
$this->assertTrue(is_string($results) && !empty($results));
Expand All @@ -121,7 +121,7 @@ public function testGetWhoisServerDirectNoException()
*/
public function testGetWhoisServerDirectUnicodeException()
{
$var = new Locator;
$var = new DomainLocator;
$this->expectException(UnknownWhoisException::class);

$results = $var->getWhoisServer('xn--e1afmkfd.xn--80akhbyknj4f');
Expand Down
6 changes: 3 additions & 3 deletions tests/WhoisLocatorLookupsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace MallardDuck\Whois\Test;

use PHPUnit\Framework\TestCase;
use MallardDuck\Whois\WhoisServerList\Locator;
use MallardDuck\Whois\WhoisServerList\DomainLocator;

/**
* Corresponding Class to test the Locator class
Expand All @@ -24,7 +24,7 @@ class WhoisLocatorLookupsTest extends TestCase
*/
public function testFindAndGetCorrectDomainWhoisServer($domain, $server)
{
$var = new Locator;
$var = new DomainLocator;
$results = $var->findWhoisServer($domain)->getWhoisServer();
$this->assertTrue(is_string($results) && !empty($results));
$this->assertTrue($server === $results);
Expand All @@ -39,7 +39,7 @@ public function testFindAndGetCorrectDomainWhoisServer($domain, $server)
*/
public function testGetCorrectDomainWhoisServer($domain, $server)
{
$var = new Locator;
$var = new DomainLocator;
$results = $var->getWhoisServer($domain);
$this->assertTrue(is_string($results) && !empty($results));
$this->assertTrue($server === $results);
Expand Down
10 changes: 5 additions & 5 deletions tests/WhoisLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace MallardDuck\Whois\Test;

use PHPUnit\Framework\TestCase;
use MallardDuck\Whois\WhoisServerList\Locator;
use MallardDuck\Whois\WhoisServerList\DomainLocator;

/**
* Corresponding Class to test the Locator class
Expand All @@ -20,7 +20,7 @@ class WhoisLocatorTest extends TestCase
*/
public function testIsThereAnySyntaxError()
{
$var = new Locator;
$var = new DomainLocator;
$this->assertTrue(is_object($var));
unset($var);
}
Expand All @@ -30,7 +30,7 @@ public function testIsThereAnySyntaxError()
*/
public function testLoadedListFile()
{
$var = new Locator;
$var = new DomainLocator;
$this->assertTrue(is_object($var) && $var->getLoadStatus());
unset($var);
}
Expand All @@ -40,13 +40,13 @@ public function testLoadedListFile()
*/
public function testFindWhoisServer()
{
$var = new Locator;
$var = new DomainLocator;
$var->findWhoisServer("google.com");
$match = $var->getLastMatch();
$this->assertTrue(is_array($match) && !empty($match) && count($match) >= 1);
unset($var, $match);

$var = new Locator;
$var = new DomainLocator;
$var->findWhoisServer("danpock.xyz");
$match = $var->getLastMatch();
$this->assertTrue(is_array($match) && !empty($match) && count($match) >= 1);
Expand Down

0 comments on commit 919da69

Please sign in to comment.