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