Registration::test_add_temporary_password PHP Method

test_add_temporary_password() public method

    public function test_add_temporary_password()
    {
        global $_POST;
        // Test for base64-encoded password key in $meta array, matching input password
        $_POST['password_1'] = 'colloquy glint tendril choler';
        $meta = \Pressbooks\Registration\add_temporary_password(array());
        $this->assertEquals('colloquy glint tendril choler', base64_decode($meta['password']));
        // Test for absence of password key in $meta array when no password is provided
        unset($_POST['password_1']);
        $meta = \Pressbooks\Registration\add_temporary_password(array());
        $this->assertArrayNotHasKey('password', $meta);
    }