-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add PHPUnit & Travis CI support
Closes #1 Additions: - [composer] PHPUnit test dependency - [make] test target - [tests] basic Netscape bookmarke parsing - [travis] configuration file Modifications: - update LICENSE Signed-off-by: VirtualTam <[email protected]>
- Loading branch information
1 parent
12d93f9
commit 74729ba
Showing
7 changed files
with
69 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
composer.lock | ||
vendor |
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,12 @@ | ||
sudo: false | ||
language: php | ||
php: | ||
- 7.0 | ||
- 5.6 | ||
- 5.5 | ||
- 5.4 | ||
install: | ||
- composer self-update | ||
- composer install | ||
script: | ||
- make test |
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,4 @@ | ||
BIN = vendor/bin | ||
|
||
test: | ||
@$(BIN)/phpunit tests |
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,34 @@ | ||
<?php | ||
|
||
/** | ||
* Ensure basic Netscape bookmarks are properly parsed | ||
* | ||
* @see https://msdn.microsoft.com/en-us/library/aa753582%28v=vs.85%29.aspx | ||
* @see http://www.w3schools.com/tags/tag_dl.asp | ||
*/ | ||
class ParseNetscapeBookmarksTest extends PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Parse a basic Netscape file | ||
*/ | ||
public function test_parse_basic() | ||
{ | ||
$bkm = parse_netscape_bookmarks( | ||
file_get_contents('tests/input/netscape_basic.htm') | ||
); | ||
$this->assertEquals(2, sizeof($bkm)); | ||
|
||
$this->assertEquals('Secret stuff', $bkm[0]['title']); | ||
$this->assertEquals(0, $bkm[0]['pub']); | ||
$this->assertEquals('private secret', $bkm[0]['tags']); | ||
$this->assertEquals( | ||
'Super-secret stuff you\'re not supposed to know about', | ||
$bkm[0]['note'] | ||
); | ||
|
||
$this->assertEquals('Public stuff', $bkm[1]['title']); | ||
$this->assertEquals(1, $bkm[1]['pub']); | ||
$this->assertEquals('public hello world', $bkm[1]['tags']); | ||
$this->assertEquals('', $bkm[1]['note']); | ||
} | ||
} |
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,11 @@ | ||
<!DOCTYPE NETSCAPE-Bookmark-file-1> | ||
<!-- This is an automatically generated file. | ||
It will be read and overwritten. | ||
Do Not Edit! --> | ||
<TITLE>Bookmarks</TITLE> | ||
<H1>Bookmarks</H1> | ||
<DL><p> | ||
<DT><A HREF="https://private.tld" ADD_DATE="" PRIVATE="1" TAGS="private secret">Secret stuff</A> | ||
<DD>Super-secret stuff you're not supposed to know about | ||
<DT><A HREF="http://public.tld" ADD_DATE="" PRIVATE="0" TAGS="public hello world">Public stuff</A> | ||
</DL><p> |