]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge commit 'mainline-write/0.8.x' into 0.8.x
authorBrenda Wallace <shiny@cpan.org>
Tue, 25 Aug 2009 22:02:07 +0000 (10:02 +1200)
committerBrenda Wallace <shiny@cpan.org>
Tue, 25 Aug 2009 22:02:07 +0000 (10:02 +1200)
1  2 
tests/HashTagDetectionTests.php

index 4f0b31b0df054749c21e393300a989e924ce76bf,0000000000000000000000000000000000000000..283226bd46943b8c5856210b3d96517ceff4f62c
mode 100644,000000..100644
--- /dev/null
@@@ -1,35 -1,0 +1,47 @@@
-                      array('#hello',
-                            '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>'),
 +<?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('LACONICA', true);
 +
 +require_once INSTALLDIR . '/lib/common.php';
 +
 +class HashTagDetectionTests extends PHPUnit_Framework_TestCase
 +{
 +    /**
 +     * @dataProvider provider
 +     *
 +     */
 +    public function testProduction($content, $expected)
 +    {
 +        $rendered = common_render_text($content);
 +        $this->assertEquals($expected, $rendered);
 +    }
 +
 +    static public function provider()
 +    {
 +        return array(
 +                     array('hello',
 +                           'hello'),
++                     array('#hello people',
++                           '#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span> people'),
++                     array('"#hello" people',
++                           '&quot;#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>&quot; people'),
++                     array('say "#hello" people',
++                           'say &quot;#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>&quot; people'),
++                     array('say (#hello) people',
++                           'say (#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>) people'),
++                     array('say [#hello] people',
++                           'say [#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>] people'),
++                     array('say {#hello} people',
++                           'say {#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>} people'),
++                     array('say \'#hello\' people',
++                           'say \'#<span class="tag"><a href="' . common_local_url('tag', array('tag' => common_canonical_tag('hello'))) . '" rel="tag">hello</a></span>\' people'),
 +                     );
 +    }
 +}
 +