TagURITest.php 1010 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
  3. print "This script must be run from the command line\n";
  4. exit();
  5. }
  6. define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
  7. define('GNUSOCIAL', true);
  8. define('STATUSNET', true); // compatibility
  9. require_once INSTALLDIR . '/lib/common.php';
  10. $config['site']['server'] = 'example.net';
  11. $config['site']['path'] = '/apps/statusnet';
  12. class TagURITest extends PHPUnit_Framework_TestCase
  13. {
  14. /**
  15. * @dataProvider provider
  16. */
  17. public function testProduction($format, $args, $uri)
  18. {
  19. $minted = call_user_func_array(array('TagURI', 'mint'),
  20. array_merge(array($format), $args));
  21. $this->assertEquals($uri, $minted);
  22. }
  23. static public function provider()
  24. {
  25. return array(array('favorite:%d:%d',
  26. array(1, 3),
  27. 'tag:example.net,'.date('Y-m-d').':apps:statusnet:favorite:1:3'));
  28. }
  29. }