Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

covers p #5389

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/phpunit/tests/pluggable/signatures.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Tests_Pluggable_Signatures extends WP_UnitTestCase {
* @ticket 33867
*
* @dataProvider get_defined_pluggable_functions
*
* @coversNothing
*/
public function test_pluggable_function_signatures_match( $function_name ) {

Expand Down Expand Up @@ -54,6 +56,8 @@ public function test_pluggable_function_signatures_match( $function_name ) {
*
* @ticket 33654
* @ticket 33867
*
* @coversNothing
*/
public function test_all_pluggable_functions_exist() {

Expand Down
42 changes: 42 additions & 0 deletions tests/phpunit/tests/pluggable/wpMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ public function tear_down() {
* when it encounters a line longer than 999 characters. But PHPMailer doesn't clean up after itself / presets
* all variables, which means that following tests would fail. To solve this issue we set `$this->Encoding`
* back to 8bit in `MockPHPMailer::preSend`.
*
* @covers ::wp_mail
*/
public function test_wp_mail_break_it() {
$content = str_repeat( 'A', 1000 );
$this->assertTrue( wp_mail( WP_TESTS_EMAIL, 'Looong line testing', $content ) );
}

/**
* @covers ::wp_mail
*/
public function test_wp_mail_custom_boundaries() {
$to = '[email protected]';
$subject = 'Test email with custom boundaries';
Expand Down Expand Up @@ -89,6 +94,8 @@ public function test_wp_mail_custom_boundaries() {

/**
* @ticket 17305
*
* @covers ::wp_mail
*/
public function test_wp_mail_rfc2822_addresses() {
$to = 'Name <[email protected]>';
Expand Down Expand Up @@ -119,6 +126,8 @@ public function test_wp_mail_rfc2822_addresses() {

/**
* @ticket 17305
*
* @covers ::wp_mail
*/
public function test_wp_mail_multiple_rfc2822_to_addresses() {
$to = 'Name <[email protected]>, Another Name <[email protected]>';
Expand All @@ -137,6 +146,9 @@ public function test_wp_mail_multiple_rfc2822_to_addresses() {
$this->assertSameIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
}

/**
* @covers ::wp_mail
*/
public function test_wp_mail_multiple_to_addresses() {
$to = '[email protected], [email protected]';
$subject = 'RFC2822 Testing';
Expand All @@ -152,6 +164,8 @@ public function test_wp_mail_multiple_to_addresses() {

/**
* @ticket 18463
*
* @covers ::wp_mail
*/
public function test_wp_mail_to_address_no_name() {
$to = '<[email protected]>';
Expand All @@ -167,6 +181,8 @@ public function test_wp_mail_to_address_no_name() {

/**
* @ticket 23642
*
* @covers ::wp_mail
*/
public function test_wp_mail_return_value() {
// No errors.
Expand All @@ -181,6 +197,8 @@ public function test_wp_mail_return_value() {

/**
* @ticket 30266
*
* @covers ::wp_mail
*/
public function test_wp_mail_with_valid_from_header() {
$to = '[email protected]';
Expand Down Expand Up @@ -219,6 +237,8 @@ public function test_wp_mail_with_from_header_missing_space() {

/**
* @ticket 30266
*
* @covers ::wp_mail
*/
public function test_wp_mail_with_empty_from_header() {
$to = '[email protected]';
Expand All @@ -235,6 +255,8 @@ public function test_wp_mail_with_empty_from_header() {

/**
* @ticket 30266
*
* @covers ::wp_mail
*/
public function test_wp_mail_with_empty_from_name_for_the_from_header() {
$to = '[email protected]';
Expand Down Expand Up @@ -273,6 +295,8 @@ public function test_wp_mail_with_empty_home_url() {

/**
* @ticket 30266
*
* @covers ::wp_mail
*/
public function test_wp_mail_with_valid_content_type_header() {
$to = '[email protected]';
Expand All @@ -289,6 +313,8 @@ public function test_wp_mail_with_valid_content_type_header() {

/**
* @ticket 30266
*
* @covers ::wp_mail
*/
public function test_wp_mail_with_empty_content_type_header() {
$to = '[email protected]';
Expand All @@ -305,6 +331,8 @@ public function test_wp_mail_with_empty_content_type_header() {

/**
* @ticket 30266
*
* @covers ::wp_mail
*/
public function test_wp_mail_with_empty_charset_for_the_content_type_header() {
$to = '[email protected]';
Expand All @@ -321,6 +349,8 @@ public function test_wp_mail_with_empty_charset_for_the_content_type_header() {

/**
* @ticket 43542
*
* @covers ::wp_mail
*/
public function test_wp_mail_does_not_duplicate_mime_version_header() {
$to = '[email protected]';
Expand Down Expand Up @@ -354,6 +384,8 @@ public function wp_mail_set_text_message( $mailer ) {
* https://tools.ietf.org/html/rfc2045#section-6.1
*
* @ticket 28039
*
* @covers ::wp_mail
*/
public function test_wp_mail_content_transfer_encoding_in_quoted_printable_multipart() {
add_action( 'phpmailer_init', array( $this, 'wp_mail_quoted_printable' ) );
Expand All @@ -371,6 +403,8 @@ public function test_wp_mail_content_transfer_encoding_in_quoted_printable_multi

/**
* @ticket 21659
*
* @covers ::wp_mail
*/
public function test_wp_mail_addresses_arent_encoded() {
$to = 'Lukáš To <[email protected]>';
Expand Down Expand Up @@ -413,6 +447,8 @@ public function test_wp_mail_addresses_arent_encoded() {
* set it correctly.
*
* @ticket 37736
*
* @covers ::wp_mail
*/
public function test_wp_mail_sender_not_set() {
wp_mail( '[email protected]', 'Testing the Sender field', 'The Sender field should not have been set.' );
Expand All @@ -424,6 +460,8 @@ public function test_wp_mail_sender_not_set() {

/**
* @ticket 35598
*
* @covers ::wp_mail
*/
public function test_phpmailer_exception_thrown() {
$to = 'an_invalid_address';
Expand Down Expand Up @@ -512,6 +550,8 @@ public function test_wp_mail_sends_attachments_with_custom_name() {

/**
* @ticket 50720
*
* @coversNothing
*/
public function test_phpmailer_validator() {
$phpmailer = $GLOBALS['phpmailer'];
Expand All @@ -522,6 +562,8 @@ public function test_phpmailer_validator() {
* Test for short-circuiting wp_mail().
*
* @ticket 35069
*
* @covers ::wp_mail
*/
public function test_wp_mail_can_be_shortcircuited() {
$result1 = wp_mail( WP_TESTS_EMAIL, 'Foo', 'Bar' );
Expand Down
30 changes: 30 additions & 0 deletions tests/phpunit/tests/pomo/mo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
class Tests_POMO_MO extends WP_UnitTestCase {

/**
* @covers MO::import_from_file
*/
public function test_mo_simple() {
$mo = new MO();
$mo->import_from_file( DIR_TESTDATA . '/pomo/simple.mo' );
Expand All @@ -20,6 +23,9 @@ public function test_mo_simple() {
$this->assertSame( array( 'yes' ), $mo->entries["kuku\nruku"]->translations );
}

/**
* @covers MO::translate_plural
*/
public function test_mo_plural() {
$mo = new MO();
$mo->import_from_file( DIR_TESTDATA . '/pomo/plural.mo' );
Expand All @@ -46,6 +52,9 @@ public function test_mo_plural() {
$this->assertSame( 'twoey dragoney', $mo->translate_plural( 'one dragon', '%d dragons', -8 ) );
}

/**
* @covers Translation_Entry::__construct
*/
public function test_mo_context() {
$mo = new MO();
$mo->import_from_file( DIR_TESTDATA . '/pomo/context.mo' );
Expand All @@ -72,6 +81,9 @@ public function test_mo_context() {
$this->assertSame( 'not so dragon', $mo->entries[ $single_entry->key() ]->context );
}

/**
* @covers Translation_Entry::merge_with
*/
public function test_translations_merge() {
$host = new Translations();
$host->add_entry( new Translation_Entry( array( 'singular' => 'pink' ) ) );
Expand All @@ -84,6 +96,9 @@ public function test_translations_merge() {
$this->assertSame( array(), array_diff( array( 'pink', 'green', 'red' ), array_keys( $host->entries ) ) );
}

/**
* @covers MO::export_to_file
*/
public function test_export_mo_file() {
$entries = array();
$entries[] = new Translation_Entry(
Expand Down Expand Up @@ -142,6 +157,9 @@ public function test_export_mo_file() {
}
}

/**
* @covers MO::export_to_file
*/
public function test_export_should_not_include_empty_translations() {
$entries = array();
$mo = new MO();
Expand All @@ -161,6 +179,9 @@ public function test_export_should_not_include_empty_translations() {
$this->assertCount( 0, $again->entries );
}

/**
* @covers MO::translate_plural
*/
public function test_nplurals_with_backslashn() {
$mo = new MO();
$mo->import_from_file( DIR_TESTDATA . '/pomo/bad_nplurals.mo' );
Expand All @@ -169,13 +190,19 @@ public function test_nplurals_with_backslashn() {
$this->assertSame( '%d foros', $mo->translate_plural( '%d forum', '%d forums', -1 ) );
}

/**
* @covers MO::import_from_file
*/
public function disabled_test_performance() {
$start = microtime( true );
$mo = new MO();
$mo->import_from_file( DIR_TESTDATA . '/pomo/de_DE-2.8.mo' );
// echo "\nPerformance: ".(microtime(true) - $start)."\n";
}

/**
* @covers Translation_Entry::translations
*/
public function test_overloaded_mb_functions() {
if ( ( ini_get( 'mbstring.func_overload' ) & 2 ) === 0 ) {
$this->markTestSkipped( 'This test requires mbstring.func_overload to be enabled.' );
Expand All @@ -186,6 +213,9 @@ public function test_overloaded_mb_functions() {
$this->assertSame( array( 'Табло' ), $mo->entries['Dashboard']->translations );
}

/**
* @covers MO::import_from_file
*/
public function test_load_pot_file() {
$mo = new MO();
$this->assertFalse( $mo->import_from_file( DIR_TESTDATA . '/pomo/mo.pot' ) );
Expand Down
18 changes: 18 additions & 0 deletions tests/phpunit/tests/pomo/noopTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,48 @@ public function set_up() {
);
}

/**
* @covers NOOP_Translations::get_header
*/
public function test_get_header() {
$this->assertFalse( $this->noop->get_header( 'Content-Type' ) );
}

/**
* @covers NOOP_Translations::add_entry
*/
public function test_add_entry() {
$this->noop->add_entry( $this->entry );
$this->assertSame( array(), $this->noop->entries );
}

/**
* @covers NOOP_Translations::set_header
*/
public function test_set_header() {
$this->noop->set_header( 'header', 'value' );
$this->assertSame( array(), $this->noop->headers );
}

/**
* @covers NOOP_Translations::translate_entry
*/
public function test_translate_entry() {
$this->noop->add_entry( $this->entry );
$this->assertFalse( $this->noop->translate_entry( $this->entry ) );
}

/**
* @covers NOOP_Translations::translate
*/
public function test_translate() {
$this->noop->add_entry( $this->entry );
$this->assertSame( 'baba', $this->noop->translate( 'baba' ) );
}

/**
* @covers NOOP_Translations::translate_plural
*/
public function test_plural() {
$this->noop->add_entry( $this->plural_entry );
$this->assertSame( 'dyado', $this->noop->translate_plural( 'dyado', 'dyados', 1 ) );
Expand Down
8 changes: 8 additions & 0 deletions tests/phpunit/tests/pomo/pluralForms.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ protected static function parenthesize_plural_expression( $expression ) {
* @ticket 41562
* @dataProvider data_locales
* @group external-http
*
* @covers GP_Locales::locales
*/
public function test_regression( $lang, $nplurals, $expression ) {
require_once dirname( __DIR__, 2 ) . '/includes/plural-form-function.php';
Expand Down Expand Up @@ -94,6 +96,8 @@ public static function data_locales() {
/**
* @ticket 41562
* @dataProvider data_simple
*
* @covers Plural_Forms::__construct
*/
public function test_simple( $expression, $expected ) {
$plural_forms = new Plural_Forms( $expression );
Expand Down Expand Up @@ -161,6 +165,8 @@ public static function data_simple() {
*
* @ticket 41562
* @dataProvider data_exceptions
*
* @covers Plural_Forms::__construct
*/
public function test_exceptions( $expression, $expected_message, $call_get ) {
$this->expectException( 'Exception' );
Expand Down Expand Up @@ -214,6 +220,8 @@ public function data_exceptions() {

/**
* @ticket 41562
*
* @covers Plural_Forms::__construct
*/
public function test_cache() {
$mock = $this->getMockBuilder( 'Plural_Forms' )
Expand Down
Loading
Loading