| 443 | /** |
| 444 | * @ticket 36476 |
| 445 | */ |
| 446 | public function test_wp_authenticate_username_password_with_wp_user_object() { |
| 447 | $result = wp_authenticate_username_password( self::$_user, '', '' ); |
| 448 | $this->assertSame( $result->ID, self::$user_id ); |
| 449 | } |
| 450 | |
| 451 | /** |
| 452 | * @ticket 36476 |
| 453 | */ |
| 454 | public function test_wp_authenticate_username_password_with_login_and_password() { |
| 455 | $result = wp_authenticate_username_password( null, self::USER_LOGIN, self::USER_PASS ); |
| 456 | $this->assertSame( self::$user_id, $result->ID ); |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * @ticket 36476 |
| 461 | */ |
| 462 | public function test_wp_authenticate_username_password_with_null_password() { |
| 463 | $result = wp_authenticate_username_password( null, self::USER_LOGIN, null ); |
| 464 | $this->assertInstanceOf( 'WP_Error', $result ); |
| 465 | } |
| 466 | |
| 467 | /** |
| 468 | * @ticket 36476 |
| 469 | */ |
| 470 | public function test_wp_authenticate_username_password_with_null_login() { |
| 471 | $result = wp_authenticate_username_password( null, null, self::USER_PASS ); |
| 472 | $this->assertInstanceOf( 'WP_Error', $result ); |
| 473 | } |
| 474 | |
| 475 | /** |
| 476 | * @ticket 36476 |
| 477 | */ |
| 478 | public function test_wp_authenticate_username_password_with_invalid_login() { |
| 479 | $result = wp_authenticate_username_password( null, 'invalidlogin', self::USER_PASS ); |
| 480 | $this->assertInstanceOf( 'WP_Error', $result ); |
| 481 | } |
| 482 | |
| 483 | /** |
| 484 | * @ticket 36476 |
| 485 | */ |
| 486 | public function test_wp_authenticate_username_password_with_invalid_password() { |
| 487 | $result = wp_authenticate_username_password( null, self::USER_LOGIN, 'invalidpassword' ); |
| 488 | $this->assertInstanceOf( 'WP_Error', $result ); |
| 489 | } |
| 490 | |
| 491 | /** |
| 492 | * @ticket 36476 |
| 493 | */ |
| 494 | public function test_wp_authenticate_email_password_with_wp_user_object() { |
| 495 | $result = wp_authenticate_email_password( self::$_user, '', '' ); |
| 496 | $this->assertSame( self::$user_id, $result->ID ); |
| 497 | } |
| 498 | |
| 499 | /** |
| 500 | * @ticket 36476 |
| 501 | */ |
| 502 | public function test_wp_authenticate_email_password_with_login_and_password() { |
| 503 | $result = wp_authenticate_email_password( null, self::USER_EMAIL, self::USER_PASS ); |
| 504 | $this->assertSame( self::$user_id, $result->ID ); |
| 505 | } |
| 506 | |
| 507 | /** |
| 508 | * @ticket 36476 |
| 509 | */ |
| 510 | public function test_wp_authenticate_email_password_with_null_password() { |
| 511 | $result = wp_authenticate_email_password( null, self::USER_EMAIL, null ); |
| 512 | $this->assertInstanceOf( 'WP_Error', $result ); |
| 513 | } |
| 514 | |
| 515 | /** |
| 516 | * @ticket 36476 |
| 517 | */ |
| 518 | public function test_wp_authenticate_email_password_with_null_email() { |
| 519 | $result = wp_authenticate_email_password( null, null, self::USER_PASS ); |
| 520 | $this->assertInstanceOf( 'WP_Error', $result ); |
| 521 | } |
| 522 | |
| 523 | /** |
| 524 | * @ticket 36476 |
| 525 | */ |
| 526 | public function test_wp_authenticate_email_password_with_invalid_email() { |
| 527 | $result = wp_authenticate_email_password( null, 'invalid@example.com', self::USER_PASS ); |
| 528 | $this->assertInstanceOf( 'WP_Error', $result ); |
| 529 | } |
| 530 | |
| 531 | /** |
| 532 | * @ticket 36476 |
| 533 | */ |
| 534 | public function test_wp_authenticate_email_password_with_invalid_password() { |
| 535 | $result = wp_authenticate_email_password( null, self::USER_EMAIL, 'invalidpassword' ); |
| 536 | $this->assertInstanceOf( 'WP_Error', $result ); |
| 537 | } |
| 538 | |
| 539 | /** |
| 540 | * @ticket 36476 |
| 541 | */ |
| 542 | public function test_wp_authenticate_cookie_with_wp_user_object() { |
| 543 | $result = wp_authenticate_cookie( $this->user, null, null ); |
| 544 | $this->assertSame( self::$user_id, $result->ID ); |
| 545 | } |
| 546 | |
| 547 | /** |
| 548 | * @ticket 36476 |
| 549 | */ |
| 550 | public function test_wp_authenticate_cookie_with_null_params() { |
| 551 | $result = wp_authenticate_cookie( null, null, null ); |
| 552 | $this->assertNull( $result ); |
| 553 | } |
| 554 | |
| 555 | /** |
| 556 | * @ticket 36476 |
| 557 | */ |
| 558 | public function test_wp_authenticate_cookie_with_invalid_cookie() { |
| 559 | $_COOKIE[ AUTH_COOKIE ] = 'invalid_cookie'; |
| 560 | $_COOKIE[ SECURE_AUTH_COOKIE ] = 'secure_invalid_cookie'; |
| 561 | |
| 562 | $result = wp_authenticate_cookie( null, null, null ); |
| 563 | $this->assertInstanceOf( 'WP_Error', $result ); |
| 564 | } |
| 565 | |