Make WordPress Core

Changeset 909 in tests for trunk/tests/mail.php


Ignore:
Timestamp:
07/19/2012 01:52:37 AM (12 years ago)
Author:
nacin
Message:

Complete the renaming described in [904].

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/tests/mail.php

    r904 r909  
    11<?php
    2 
    3 /**
    4  * @group pluggable
    5  */
    6 class TestAuthFunctions extends WP_UnitTestCase {
    7     var $user_id;
    8 
    9     function setUp() {
    10         parent::setUp();
    11         $this->user_id = $this->factory->user->create();
    12     }
    13 
    14     function test_auth_cookie_valid() {
    15         $cookie = wp_generate_auth_cookie( $this->user_id, time() + 3600, 'auth' );
    16         $this->assertEquals( $this->user_id, wp_validate_auth_cookie( $cookie, 'auth' ) );
    17     }
    18 
    19     function test_auth_cookie_invalid() {
    20         // 3600 or less and +3600 may occur in wp_validate_auth_cookie(),
    21         // as an ajax test may have defined DOING_AJAX, failing the test.
    22 
    23         $cookie = wp_generate_auth_cookie( $this->user_id, time() - 7200, 'auth' );
    24         $this->assertEquals( false, wp_validate_auth_cookie( $cookie, 'auth' ), 'expired cookie' );
    25 
    26         $cookie = wp_generate_auth_cookie( $this->user_id, time() + 3600, 'auth' );
    27         $this->assertEquals( false, wp_validate_auth_cookie( $cookie, 'logged_in' ), 'wrong auth scheme' );
    28 
    29         $cookie = wp_generate_auth_cookie( $this->user_id, time() + 3600, 'auth' );
    30         list($a, $b, $c) = explode('|', $cookie);
    31         $cookie = $a . '|' . ($b + 1) . '|' . $c;
    32         $this->assertEquals( false, wp_validate_auth_cookie( $this->user_id, 'auth' ), 'altered cookie' );
    33     }
    34 
    35     function test_auth_cookie_scheme() {
    36         // arbitrary scheme name
    37         $cookie = wp_generate_auth_cookie( $this->user_id, time() + 3600, 'foo' );
    38         $this->assertEquals( $this->user_id, wp_validate_auth_cookie( $cookie, 'foo' ) );
    39 
    40         // wrong scheme name - should fail
    41         $cookie = wp_generate_auth_cookie( $this->user_id, time() + 3600, 'foo' );
    42         $this->assertEquals( false, wp_validate_auth_cookie( $cookie, 'bar' ) );
    43     }
    44 }
    452
    463/**
     
    496 * @ticket UT47
    507 */
    51 class TestMailFunctions extends WP_UnitTestCase {
     8class Tests_Mail extends WP_UnitTestCase {
    529    function setUp() {
    5310        parent::setUp();
     
    255212    }
    256213}
    257 
    258 /**
    259  * @group pluggable
    260  */
    261 class TestRedirectFunctions extends WP_UnitTestCase {
    262     function test_wp_sanitize_redirect() {
    263         $this->assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0Ago'));
    264         $this->assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0ago'));
    265         $this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0Dgo'));
    266         $this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0dgo'));
    267         //Nesting checks
    268         $this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0ddgo'));
    269         $this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0DDgo'));
    270     }
    271 }
Note: See TracChangeset for help on using the changeset viewer.