[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/tests/tests/shorturl/ -> duplicate.php (source)

   1  <?php
   2  
   3  /**
   4   * Short URLs : test with "allow duplicate long URL"
   5   *
   6   * @group shorturls
   7   * @since 0.1
   8   */
   9  
  10  class ShortURL_Duplicate_Long_URL_Tests extends PHPUnit\Framework\TestCase {
  11  
  12      public function test_yourls_allow_duplicate_longurls_is_bool() {
  13          $this->assertIsBool(yourls_allow_duplicate_longurls());
  14      }
  15  
  16      public function test_add_url_twice() {
  17          $url     = 'http://' . rand_str(5);
  18  
  19          $newurl = yourls_add_new_link( $url, rand_str(), rand_str() );
  20          $this->assertEquals( 'success', $newurl['status'] );
  21  
  22          $fail = yourls_add_new_link( $url, rand_str(), rand_str() );
  23          $this->assertEquals( 'fail', $fail['status'] );
  24  
  25          yourls_add_filter('allow_duplicate_longurls', 'yourls_return_true');
  26          $newurl = yourls_add_new_link( $url, rand_str(), rand_str() );
  27          $this->assertEquals( 'success', $newurl['status'] );
  28  
  29          yourls_remove_all_filters('allow_duplicate_longurls');
  30      }
  31  
  32  }


Generated: Wed Sep 28 05:10:02 2022 Cross-referenced by PHPXref 0.7.1