diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..987e2a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +composer.lock +vendor diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9a97af2 --- /dev/null +++ b/.travis.yml @@ -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 diff --git a/LICENSE b/LICENSE index 4c16a80..92886b4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 +Copyright (c) 2015-2016 Kafene and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c6b7c61 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +BIN = vendor/bin + +test: + @$(BIN)/phpunit tests diff --git a/composer.json b/composer.json index fd3bd11..27bb726 100644 --- a/composer.json +++ b/composer.json @@ -4,5 +4,9 @@ "keywords": ["parse", "bookmark", "netscape"], "homepage": "https://github.com/kafene/BookmarkParser", "license": "MIT", - "autoload": {"files": ["parse_netscape_bookmarks.php"]} + "autoload": {"files": ["parse_netscape_bookmarks.php"]}, + "require": {}, + "require-dev": { + "phpunit/phpunit": "4.6.*" + } } diff --git a/tests/ParseNetscapeBookmarksTest.php b/tests/ParseNetscapeBookmarksTest.php new file mode 100644 index 0000000..1889c9a --- /dev/null +++ b/tests/ParseNetscapeBookmarksTest.php @@ -0,0 +1,34 @@ +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']); + } +} diff --git a/tests/input/netscape_basic.htm b/tests/input/netscape_basic.htm new file mode 100644 index 0000000..b12cce0 --- /dev/null +++ b/tests/input/netscape_basic.htm @@ -0,0 +1,11 @@ + + +Bookmarks +

Bookmarks

+

+

Secret stuff +
Super-secret stuff you're not supposed to know about +
Public stuff +