| 311 | /** |
| 312 | * The function should respect the user locale settings when the site uses the default locale. |
| 313 | * |
| 314 | * @ticket 44721 |
| 315 | * @group l10n |
| 316 | */ |
| 317 | public function test_should_send_fulfillment_email_in_user_locale() { |
| 318 | update_user_meta( self::$request_user->ID, 'locale', 'es_ES' ); |
| 319 | |
| 320 | _wp_privacy_send_erasure_fulfillment_notification( self::$request_id ); |
| 321 | $mailer = tests_retrieve_phpmailer_instance(); |
| 322 | |
| 323 | $this->assertContains( 'Solicitud de borrado completada', $mailer->get_sent()->subject ); |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * The function should respect the user locale settings when the site does not use en_US, the administrator |
| 328 | * uses the site's default locale, and the user has a different locale. |
| 329 | * |
| 330 | * @ticket 44721 |
| 331 | * @group l10n |
| 332 | */ |
| 333 | public function test_should_send_fulfillment_email_in_user_locale_when_site_is_not_en_us() { |
| 334 | update_option( 'WPLANG', 'es_ES' ); |
| 335 | switch_to_locale( 'es_ES' ); |
| 336 | |
| 337 | update_user_meta( self::$request_user->ID, 'locale', 'de_DE' ); |
| 338 | wp_set_current_user( self::$admin_user->ID ); |
| 339 | |
| 340 | _wp_privacy_send_erasure_fulfillment_notification( self::$request_id ); |
| 341 | $mailer = tests_retrieve_phpmailer_instance(); |
| 342 | |
| 343 | $this->assertContains( 'Löschauftrag ausgeführt', $mailer->get_sent()->subject ); |
| 344 | } |
| 345 | |
| 346 | /** |
| 347 | * The function should respect the user locale settings when the site is not en_US, the administrator |
| 348 | * has a different selected locale, and the user uses the site's default locale. |
| 349 | * |
| 350 | * @ticket 44721 |
| 351 | * @group l10n |
| 352 | */ |
| 353 | public function test_should_send_fulfillment_email_in_user_locale_when_admin_and_site_have_different_locales() { |
| 354 | update_option( 'WPLANG', 'es_ES' ); |
| 355 | switch_to_locale( 'es_ES' ); |
| 356 | |
| 357 | update_user_meta( self::$admin_user->ID, 'locale', 'de_DE' ); |
| 358 | wp_set_current_user( self::$admin_user->ID ); |
| 359 | |
| 360 | _wp_privacy_send_erasure_fulfillment_notification( self::$request_id ); |
| 361 | $mailer = tests_retrieve_phpmailer_instance(); |
| 362 | |
| 363 | $this->assertContains( 'Solicitud de borrado completada', $mailer->get_sent()->subject ); |
| 364 | } |
| 365 | |
| 366 | /** |
| 367 | * The function should respect the user locale settings when the site is not en_US and both the |
| 368 | * administrator and the user use different locales. |
| 369 | * |
| 370 | * @ticket 44721 |
| 371 | * @group l10n |
| 372 | */ |
| 373 | public function test_should_send_fulfillment_email_in_user_locale_when_both_have_different_locales_than_site() { |
| 374 | update_option( 'WPLANG', 'es_ES' ); |
| 375 | switch_to_locale( 'es_ES' ); |
| 376 | |
| 377 | update_user_meta( self::$admin_user->ID, 'locale', 'en_US' ); |
| 378 | update_user_meta( self::$request_user->ID, 'locale', 'de_DE' ); |
| 379 | |
| 380 | wp_set_current_user( self::$admin_user->ID ); |
| 381 | |
| 382 | _wp_privacy_send_erasure_fulfillment_notification( self::$request_id ); |
| 383 | $mailer = tests_retrieve_phpmailer_instance(); |
| 384 | |
| 385 | $this->assertContains( 'Löschauftrag ausgeführt', $mailer->get_sent()->subject ); |
| 386 | } |
| 387 | |
| 388 | /** |
| 389 | * The function should respect the site's locale when the request is for an unregistered user and the |
| 390 | * administrator does not use the site's locale. |
| 391 | * |
| 392 | * @ticket 44721 |
| 393 | * @group l10n |
| 394 | */ |
| 395 | public function test_should_send_fulfillment_email_in_site_locale() { |
| 396 | update_user_meta( self::$admin_user->ID, 'locale', 'es_ES' ); |
| 397 | wp_set_current_user( self::$admin_user->ID ); |
| 398 | |
| 399 | $request_id = wp_create_user_request( 'erase-user-not-registered@example.com', 'remove_personal_data' ); |
| 400 | wp_update_post( |
| 401 | array( |
| 402 | 'ID' => $request_id, |
| 403 | 'post_status' => 'request-completed', |
| 404 | ) |
| 405 | ); |
| 406 | |
| 407 | _wp_privacy_send_erasure_fulfillment_notification( $request_id ); |
| 408 | $mailer = tests_retrieve_phpmailer_instance(); |
| 409 | |
| 410 | $this->assertContains( 'Erasure Request Fulfilled', $mailer->get_sent()->subject ); |
| 411 | } |
| 412 | |
| 413 | /** |
| 414 | * The function should respect the site's locale when it is not en_US, the request is for an |
| 415 | * unregistered user, and the administrator does not use the site's default locale. |
| 416 | * |
| 417 | * @ticket 44721 |
| 418 | * @group l10n |
| 419 | */ |
| 420 | public function test_should_send_fulfillment_email_in_site_locale_when_not_en_us_and_admin_has_different_locale() { |
| 421 | update_option( 'WPLANG', 'es_ES' ); |
| 422 | switch_to_locale( 'es_ES' ); |
| 423 | |
| 424 | update_user_meta( self::$admin_user->ID, 'locale', 'de_DE' ); |
| 425 | wp_set_current_user( self::$admin_user->ID ); |
| 426 | |
| 427 | $request_id = wp_create_user_request( 'erase-user-not-registered@example.com', 'remove_personal_data' ); |
| 428 | wp_update_post( |
| 429 | array( |
| 430 | 'ID' => $request_id, |
| 431 | 'post_status' => 'request-completed', |
| 432 | ) |
| 433 | ); |
| 434 | |
| 435 | _wp_privacy_send_erasure_fulfillment_notification( $request_id ); |
| 436 | $mailer = tests_retrieve_phpmailer_instance(); |
| 437 | |
| 438 | $this->assertContains( 'Solicitud de borrado completada', $mailer->get_sent()->subject ); |
| 439 | } |