WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 2 months ago

#41860 closed enhancement (fixed)

Unit test for wp_auth_check()

Reported by: pbearne Owned by: 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 3 months ago.
Unit tests
41860.2.patch (1.3 KB) - added by birgire 3 months ago.
41860.3.patch (1.7 KB) - added by birgire 3 months ago.
This should be the correct file ;-)
41860.4.patch (1.7 KB) - added by birgire 3 months ago.

Download all attachments as: .zip

Change History (12)

@pbearne
3 months ago

Unit tests

@birgire
3 months ago

#1 @birgire
3 months 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
3 months ago

This should be the correct file ;-)

#2 @pbearne
3 months ago

@birgire that looks better :-)

Good catches

#3 @pbearne
3 months ago

  • Keywords has-patch added

#5 @birgire
3 months ago

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

#6 @johnbillion
3 months 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
3 months ago

#7 @birgire
3 months 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
2 months 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.