-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
821e1ac
commit 112faa9
Showing
8 changed files
with
102 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
namespace vipnytt\SitemapParser\Tests; | ||
|
||
use vipnytt\SitemapParser; | ||
|
||
class ExceptionEncodingTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Test if exception is thrown when extension `simpleXML` is not loaded | ||
*/ | ||
public function testExceptionEncoding() | ||
{ | ||
if (!mb_internal_encoding('UTF-8')) { | ||
$this->expectException('\vipnytt\SitemapParser\Exceptions\SitemapParserException'); | ||
new SitemapParser('SitemapParser'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
namespace vipnytt\SitemapParser\Tests; | ||
|
||
use vipnytt\SitemapParser; | ||
|
||
class ExceptionMBStringTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Test if exception is thrown when extension `simpleXML` is not loaded | ||
*/ | ||
public function testExceptionMBString() | ||
{ | ||
if (!extension_loaded('mbstring')) { | ||
$this->expectException('\vipnytt\SitemapParser\Exceptions\SitemapParserException'); | ||
new SitemapParser('SitemapParser'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
namespace vipnytt\SitemapParser\Tests; | ||
|
||
use vipnytt\SitemapParser; | ||
|
||
class ExceptionSimpleXMLTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Test if exception is thrown when extension `simpleXML` is not loaded | ||
*/ | ||
public function testExceptionSimpleXML() | ||
{ | ||
if (!extension_loaded('simplexml')) { | ||
$this->expectException('\vipnytt\SitemapParser\Exceptions\SitemapParserException'); | ||
new SitemapParser('SitemapParser'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
namespace vipnytt\SitemapParser\Tests; | ||
|
||
use vipnytt\SitemapParser; | ||
|
||
class InvalidURLTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @dataProvider generateDataForTest | ||
* @param string $url URL | ||
*/ | ||
public function testInvalidURL($url) | ||
{ | ||
$this->expectException('\vipnytt\SitemapParser\Exceptions\SitemapParserException'); | ||
$parser = new SitemapParser('SitemapParser'); | ||
$this->assertInstanceOf('vipnytt\SitemapParser', $parser); | ||
$parser->parse($url); | ||
} | ||
|
||
/** | ||
* Generate test data | ||
* @return array | ||
*/ | ||
public function generateDataForTest() | ||
{ | ||
return [ | ||
[ | ||
'htt://www.example.c/', | ||
], | ||
[ | ||
'http:/www.example.com/', | ||
], | ||
[ | ||
'https//www.example.com/', | ||
] | ||
]; | ||
} | ||
} |