Changeset 59163
- Timestamp:
- 10/03/2024 11:42:43 PM (2 months ago)
- Location:
- trunk/tests/phpunit/tests/formatting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/linksAddBaseUrl.php
r59162 r59163 2 2 3 3 /** 4 * Tests for the links_add_base_url function.4 * Tests for the links_add_base_url() function. 5 5 * 6 6 * @group formatting … … 8 8 * @covers ::links_add_base_url 9 9 */ 10 class Tests_ formatting_linksAddBaseUrl extends WP_UnitTestCase {10 class Tests_Formatting_LinksAddBaseUrl extends WP_UnitTestCase { 11 11 12 12 /** … … 16 16 */ 17 17 public function test_links_add_base_url( $content, $base, $attrs, $expected ) { 18 if ( $attrs ) { 18 if ( is_null( $attrs ) ) { 19 $this->assertSame( $expected, links_add_base_url( $content, $base ) ); 20 } else { 19 21 $this->assertSame( $expected, links_add_base_url( $content, $base, $attrs ) ); 20 } else {21 $this->assertSame( $expected, links_add_base_url( $content, $base ) );22 22 } 23 23 } 24 24 25 25 /** 26 * Data provider for test_links_add_base_url().26 * Data provider. 27 27 * 28 * @return array[] 28 * @return array { 29 * @type array { 30 * @type string $content String to search for links in. 31 * @type string $base The base URL to prefix to links. 32 * @type array|null $attrs The attributes which should be processed. 33 * @type string $expected Expected output. 34 * } 35 * } 29 36 */ 30 37 public function data_links_add_base_url() { … … 42 49 'expected' => '<a href="http://localhost/url" />', 43 50 ), 44 'relative _scheme' => array(51 'relative scheme' => array( 45 52 'content' => '<a href="//localhost/url" />', 46 53 'base' => 'http://localhost', … … 48 55 'expected' => '<a href="http://localhost/url" />', 49 56 ), 50 'empty _array' => array(57 'empty array' => array( 51 58 'content' => '<a href="url" target="_blank" />', 52 59 'base' => 'https://localhost', 53 60 'attrs' => array(), 54 'expected' => '<a href="https://localhost/url" target=" _blank" />',61 'expected' => '<a href="https://localhost/url" target="https://localhost/_blank" />', 55 62 ), 56 'data _url' => array(63 'data-url' => array( 57 64 'content' => '<a href="url" data-url="url" />', 58 65 'base' => 'https://localhost', … … 66 73 'expected' => '<a href="https://localhost/url" />', 67 74 ), 68 'no _href' => array(75 'no href' => array( 69 76 'content' => '<a data-url="/url" />', 70 77 'base' => 'https://localhost', -
trunk/tests/phpunit/tests/formatting/linksAddTarget.php
r55563 r59163 1 1 <?php 2 2 /** 3 * Tests for the links_add_target() function. 4 * 3 5 * @group formatting 4 6 * … … 8 10 9 11 /** 10 * Tests the links_add_target() function.12 * @ticket 26164 11 13 * 12 14 * @dataProvider data_links_add_target … … 27 29 * @return array { 28 30 * @type array { 29 * @type string $content String to search for links in.30 * @type string $target The target to add to the links.31 * @type string$tags An array of tags to apply to.32 * @type string $expected Expected output.31 * @type string $content String to search for links in. 32 * @type string $target The target to add to the links. 33 * @type array|null $tags An array of tags to apply to. 34 * @type string $expected Expected output. 33 35 * } 34 36 * }
Note: See TracChangeset
for help on using the changeset viewer.