Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#41860 closed enhancement (fixed)

Unit test for wp_auth_check()

Reported by: pbearne's profile pbearne Owned by: johnbillion's profile johnbillion
Milestone: 4.9 Priority: low
Severity: normal Version:
Component: Login and Registration Keywords: has-patch
Focuses: Cc:

Description

Hi All

Just some Unit tests for function wp_auth_check() from functions.php

Paul

Attachments (4)

wp_auth_check.php.patch (1.4 KB) - added by pbearne 8 years ago.
Unit tests
41860.2.patch (1.3 KB) - added by birgire 8 years ago.
41860.3.patch (1.7 KB) - added by birgire 8 years ago.
This should be the correct file ;-)
41860.4.patch (1.7 KB) - added by birgire 8 years ago.

Download all attachments as: .zip

Change History (12)

@pbearne
8 years ago

Unit tests

@birgire
8 years ago

#1 @birgire
8 years ago

Hi @pbearne

It looks good to me.

Just two remarks:

  • Missing @ticket annotation for each method? ... or is that only for bug referencing?
  • as the modified global state can affect other test methods, shouldn't we restore it, if we modify it?

I updated the patch with this in mind in 41860.2.patch

@birgire
8 years ago

This should be the correct file ;-)

#2 @pbearne
8 years ago

@birgire that looks better :-)

Good catches

#3 @pbearne
8 years ago

  • Keywords has-patch added

#5 @birgire
8 years ago

@pbearne great to see a video of the patch coding, thanks for sharing

#6 @johnbillion
8 years ago

  • Milestone changed from Awaiting Review to 4.9
  • Owner set to johnbillion
  • Priority changed from normal to low
  • Status changed from new to reviewing
  • Version trunk deleted

@birgire
8 years ago

#7 @birgire
8 years ago

Updated a little bit in 41860.4.patch:

  • moved the clean-up before the assertion - see here in an unrelated ticket: 42044#comment:1.
  • changed assertEquals() to assertSame(), to avoid null, empty string and false being treated equally.

#8 @johnbillion
8 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 41710:

Login and Registration: Add unit tests for wp_auth_check().

Props pbearne, birgire

Fixes #41860

Note: See TracTickets for help on using tickets.