blob: 9f55143c0d9dbe814b670f5e7c064ebafd093b38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<?php
/**
* SemanticScuttle - your social bookmark manager.
*
* PHP version 5.
*
* @category Bookmarking
* @package SemanticScuttle
* @author Christian Weiske <cweiske@cweiske.de>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
/**
* Unit tests for the SemanticScuttle Bookmark model
*
* @category Bookmarking
* @package SemanticScuttle
* @author Christian Weiske <cweiske@cweiske.de>
* @license GPL http://www.gnu.org/licenses/gpl.html
* @link http://sourceforge.net/projects/semanticscuttle
*/
class Model_BookmarkTest extends TestBase
{
public function testIsValidUrlValid()
{
$this->assertTrue(
SemanticScuttle_Model_Bookmark::isValidUrl(
'http://example.org/foo/bar?baz=foorina'
)
);
$this->assertTrue(
SemanticScuttle_Model_Bookmark::isValidUrl(
'https://example.org/'
)
);
$this->assertTrue(
SemanticScuttle_Model_Bookmark::isValidUrl(
'ftp://user:pass@example.org/'
)
);
$this->assertTrue(
SemanticScuttle_Model_Bookmark::isValidUrl(
'mailto:cweiske@example.org'
)
);
}
public function testIsValidUrlInvalid()
{
$this->assertFalse(
SemanticScuttle_Model_Bookmark::isValidUrl(
'javascript:alert("foo")'
)
);
$this->assertFalse(
SemanticScuttle_Model_Bookmark::isValidUrl(
'foo://example.org/foo/bar'
)
);
}
}
?>
|