[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/tests/phpunit/testcases/ -> test_links.php (source)

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


Generated: Mon Oct 7 01:01:03 2024 Cross-referenced by PHPXref 0.7.1