| 1 | <?php |
| 2 | /* |
| 3 | * Test _cleanup_header_comment(). |
| 4 | * |
| 5 | * @group functions.php |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | |
| 10 | |
| 11 | class Tests_cleanup_header_comment extends WP_UnitTestCase { |
| 12 | |
| 13 | /** |
| 14 | * a string |
| 15 | */ |
| 16 | public function test_cleanup_header_comment() { |
| 17 | $this->assertEquals( 'ffffffffffffff', _cleanup_header_comment( 'ffffffffffffff' ) ); |
| 18 | } |
| 19 | |
| 20 | |
| 21 | /** |
| 22 | * trim a string |
| 23 | */ |
| 24 | public function test_cleanup_header_comment_trim() { |
| 25 | $this->assertEquals( 'ffffffffffffff', _cleanup_header_comment( ' ffffffffffffff ' ) ); |
| 26 | } |
| 27 | |
| 28 | |
| 29 | /** |
| 30 | * trim a string |
| 31 | */ |
| 32 | public function test_cleanup_header_comment_good_block() { |
| 33 | $header_comment = '<?php |
| 34 | /* |
| 35 | Plugin Name: Health Check |
| 36 | Plugin URI: https://wordpress.org/plugins/health-check/ |
| 37 | Description: Checks the health of your WordPress install |
| 38 | Version: 0.1.0 |
| 39 | Author: The Health Check Team |
| 40 | Author URI: http://health-check-team.example.com |
| 41 | Text Domain: health-check |
| 42 | Domain Path: /languages |
| 43 | */ |
| 44 | '; |
| 45 | |
| 46 | $expected_header_comment = '<?php |
| 47 | /* |
| 48 | Plugin Name: Health Check |
| 49 | Plugin URI: https://wordpress.org/plugins/health-check/ |
| 50 | Description: Checks the health of your WordPress install |
| 51 | Version: 0.1.0 |
| 52 | Author: The Health Check Team |
| 53 | Author URI: http://health-check-team.example.com |
| 54 | Text Domain: health-check |
| 55 | Domain Path: /languages'; |
| 56 | |
| 57 | $this->assertEquals( $expected_header_comment, _cleanup_header_comment( $header_comment ) ); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * trim a string |
| 62 | */ |
| 63 | public function test_cleanup_header_comment_extra_text() { |
| 64 | $header_comment = '<?php |
| 65 | /* |
| 66 | Plugin Name: Health Check |
| 67 | Plugin URI: https://wordpress.org/plugins/health-check/ |
| 68 | Description: Checks the health of your WordPress install |
| 69 | Version: 0.1.0 |
| 70 | Author: The Health Check Team |
| 71 | Author URI: http://health-check-team.example.com |
| 72 | Text Domain: health-check |
| 73 | Domain Path: /languages |
| 74 | */ ?> |
| 75 | dddlddfs |
| 76 | '; |
| 77 | |
| 78 | $expected_header_comment = '<?php |
| 79 | /* |
| 80 | Plugin Name: Health Check |
| 81 | Plugin URI: https://wordpress.org/plugins/health-check/ |
| 82 | Description: Checks the health of your WordPress install |
| 83 | Version: 0.1.0 |
| 84 | Author: The Health Check Team |
| 85 | Author URI: http://health-check-team.example.com |
| 86 | Text Domain: health-check |
| 87 | Domain Path: /languages |
| 88 | dddlddfs'; |
| 89 | |
| 90 | $this->assertEquals( $expected_header_comment, _cleanup_header_comment( $header_comment ) ); |
| 91 | } |
| 92 | } |
| 93 | |