[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/t/ -> test_links.php (source)

   1  <?php
   2  require_once ('init.php');
   3  
   4  class GP_Test_Links extends GP_UnitTestCase {
   5      
   6  	function test_gp_link_get_simple() {
   7          $this->assertEquals( '<a href="http://dir.bg/">Baba</a>', gp_link_get( 'http://dir.bg/', 'Baba' ) );
   8      }
   9      
  10  	function test_gp_link_get_attributes() {
  11          $this->assertEquals( '<a href="http://dir.bg/" target="_blank" class="edit">Baba</a>',
  12              gp_link_get( 'http://dir.bg/', 'Baba', array( 'target' => '_blank', 'class' => 'edit' ) ) );
  13      }
  14  
  15      function test_gp_link_get_should_put_the_before_attribute_before_the_link() {
  16          $this->assertEquals( 'x<a href="http://dir.bg/">Baba</a>', gp_link_get( 'http://dir.bg/', 'Baba', array( 'before' => 'x' ) ) );
  17      }
  18  
  19      function test_gp_link_get_should_put_the_after_attribute_after_the_link() {
  20          $this->assertEquals( '<a href="http://dir.bg/">Baba</a>x', gp_link_get( 'http://dir.bg/', 'Baba', array( 'after' => 'x' ) ) );
  21      }
  22      
  23      function test_gp_link_get_should_put_the_before_and_after_attributes_before_and_after_the_link() {
  24          $this->assertEquals( 'a<a href="http://dir.bg/">Baba</a>b', gp_link_get( 'http://dir.bg/', 'Baba', array( 'before' => 'a', 'after' => 'b' ) ) );
  25      }
  26      
  27  	function test_gp_link_get_escape() {
  28          $this->assertEquals( '<a href="http://dir.bg/">Baba & Dyado</a>', gp_link_get( 'http://dir.bg/', 'Baba & Dyado' ) );
  29          // clean_url() is too restrictive, so it isn't called
  30          //$this->assertEquals( '<a href="http://dir.bg/?x=5&#038;y=11">Baba</a>', gp_link_get( 'http://dir.bg/?x=5&y=11', 'Baba' ) );
  31          $this->assertEquals( '<a href="http://dir.bg/" a="&quot;">Baba</a>', gp_link_get( 'http://dir.bg/', 'Baba', array( 'a' => '"') ) );
  32      }
  33  }


Generated: Thu May 24 03:59:35 2012 Hosted by follow the white rabbit.