Opened 10 months ago

Closed 9 months ago

Last modified 9 months ago

#115 closed enhancement (fixed)

Unit tests for WP#18158

Reported by: bananastalktome Owned by:
Priority: normal Milestone:
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 10 months ago.

Download all attachments as: .zip

Change History (6)

Why is this line necessary:

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

Should the users be created explicitly with?

$this->factory->user->create();
  • 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!

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

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

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

Note: See TracTickets for help on using tickets.