Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#21 closed enhancement (fixed)

Unit tests for *_metadata_by_mid

Reported by: kovshenin Owned by:
Priority: normal Milestone: Legacy - Add New Tests
Component: Capabilities Keywords:
Cc: kovshenin

Description

Let's create a few tests for the get, update and delete _metadata_by_mid() functions.

Attachments (4)

test_includes_meta.patch​ (1.6 KB ) - added by kovshenin 15 years ago.
Here's a patch for the update_metadata_by_mid function test.
test_includes_meta2.patch​ (2.3 KB ) - added by kovshenin 15 years ago.
Improved version of the test case
test_includes_meta3.patch​ (2.7 KB ) - added by kovshenin 15 years ago.
Testing for cached values
test_includes_meta4.patch​ (3.6 KB ) - added by kovshenin 15 years ago.
Tests both update and delete _metadata_by_mid functions

Download all attachments as: .zip

Change History (9)

@kovshenin
15 years ago

Here's a patch for the update_metadata_by_mid function test.

#1 @kovshenin
15 years ago

Howdy all, this is my first time at unit testing for WordPress, so go easy on me. I've created a short test for the update_metadata_by_mid() function which has a patch in this ticket ​http://core.trac.wordpress.org/ticket/18195

A local run went smooth with 5 assertions. Hoping for some feedback!

@kovshenin
15 years ago

Improved version of the test case

#2 @kovshenin
15 years ago

I've attached an improved version of the test case, moved all the initialization to the setup method, added some invalid keys and meta id runs. Cleanup after usage. Hopefully this will do better.

@kovshenin
15 years ago

Testing for cached values

#3 @kovshenin
15 years ago

Third patch runs a test to see if caches got cleared after a meta update. This works with the latest patch to the function itself over at ​#wp18195. Let me know how this works for you. Thanks!

@kovshenin
15 years ago

Tests both update and delete _metadata_by_mid functions

#4 @kovshenin
15 years ago

Here's a version that tests both update and delete functions. The patch for both functions together has been uploaded here ​#wp18195. Have a good day!

#5 @ryan
15 years ago

  • Resolution → fixed
  • Status new → closed

(In [384]) Update and delete by mid tests. Props kovshenin. fixes #21

Note: See TracTickets for help on using tickets.