WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#115 closed enhancement (fixed)

Unit tests for WP#18158

Reported by: bananastalktome Owned by:
Milestone: Priority: normal
Component: Meta/Options Keywords:
Cc: bananastalktome@…

Description

First real unit tests here, so feedback is appreciated. Tests 'NOT EXISTS' compare for metadata. Unit tests for WP:#18158 .

Attachments (1)

UTpatch.diff (1.4 KB) - added by bananastalktome 5 years ago.

Download all attachments as: .zip

Change History (6)

#1 @scribu
5 years ago

Why is this line necessary:

delete_metadata( 'user', $this->author->ID, 'meta_key' );

#2 @kurtpayne
5 years ago

Should the users be created explicitly with?

$this->factory->user->create();

#3 @bananastalktome
5 years ago

  • Cc bananastalktome@… added

@scribu This may be an unnecessary check, but I was ensuring that, once the metadata was removed, the same type of assertion from line ~92 (with the 'NOT EXISTS' compare for 'meta_key') would then return that user. Would this be best to leave out of this particular test / is it covered already by other tests?

@kurtpayne Besides the default admin user, a user for this test is already created in the setUp method of Tests_Meta, correct?

Again, I'm new to unit testing and feedback like this is very helpful for me. Thanks!

#4 @scribu
5 years ago

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

(In [973]) add test_user_metadata_not_exists(). props bananastalktome. fixes #115

#5 @scribu
5 years ago

(In [974]) clearer formatting of queries in test_user_metadata_not_exists(). see #115

Note: See TracTickets for help on using tickets.