diff options
author | Evan Prodromou <evan@status.net> | 2010-02-20 13:23:08 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-02-20 13:23:08 -0500 |
commit | 61a072b3c492fd1b336e84655ffb6a28547acba7 (patch) | |
tree | 53b77e168e51a619094f84e6015d4dfa18ff032c /tests | |
parent | 36d21fa7162ca94ce100433da53439a67e815ba1 (diff) |
Add a library to mint tag URIs
We've been making pretty crummy tag: URIs for a while. We should
continue to favor HTTP URIs, since it's nice to be able to discover
things about an object you've shared the ID of. Where that's not
possible, this makes nicer tag URIs.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/TagURITest.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/TagURITest.php b/tests/TagURITest.php new file mode 100644 index 000000000..d23f8bfe6 --- /dev/null +++ b/tests/TagURITest.php @@ -0,0 +1,36 @@ +<?php + +if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { + print "This script must be run from the command line\n"; + exit(); +} + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); +define('STATUSNET', true); + +require_once INSTALLDIR . '/lib/common.php'; + +$config['site']['server'] = 'example.net'; +$config['site']['path'] = '/apps/statusnet'; + +class TagURITest extends PHPUnit_Framework_TestCase +{ + /** + * @dataProvider provider + */ + public function testProduction($format, $args, $uri) + { + $minted = call_user_func_array(array('TagURI', 'mint'), + array_merge(array($format), $args)); + + $this->assertEquals($uri, $minted); + } + + static public function provider() + { + return array(array('favorite:%d:%d', + array(1, 3), + 'tag:example.net,'.date('Y-m-d').':apps:statusnet:favorite:1:3')); + } +} + |