3 if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
4 print "This script must be run from the command line\n";
8 define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
9 define('STATUSNET', true);
11 require_once INSTALLDIR . '/lib/common.php';
13 class oEmbedTest extends PHPUnit_Framework_TestCase
16 public function setup()
18 //$this->old_oohembed = common_config('oohembed', 'endpoint');
21 public function tearDown()
23 //$GLOBALS['config']['attachments']['supported'] = $this->old_attachments_supported;
27 * @dataProvider fileTypeCases
30 public function testoEmbed($url, $expectedType)
33 $data = oEmbedHelper::getObject($url);
34 $this->assertEquals($expectedType, $data->type);
35 } catch (Exception $e) {
36 if ($expectedType == 'none') {
37 $this->assertEquals($expectedType, 'none', 'Should not have data for this URL.');
44 static public function fileTypeCases()
47 'http://www.flickr.com/photos/brionv/5172500179/' => 'photo',
48 'http://twitpic.com/36adw6' => 'photo',
49 'http://yfrog.com/fy42747177j' => 'photo',
50 'http://identi.ca/attachment/34437400' => 'photo',
52 'http://www.youtube.com/watch?v=eUgLR232Cnw' => 'video',
53 'http://vimeo.com/9283184' => 'video',
55 'http://en.wikipedia.org/wiki/File:Wiki.png' => 'link', // @fixme in future there may be a native provider -- will change to 'photo'
56 'http://leuksman.com/log/2010/10/29/statusnet-0-9-6-release/' => 'none',
60 foreach ($files as $url => $type) {
61 $dataset[] = array($url, $type);