WordPress Db Codeception module – 04

I’ve added term insertion and checking, to a point, to WordPress Codeception Database module.
Disassembling WordPress “as simple as possible but still hard to follow” method for storing term information and relations took me a while and I finally set for a solution that’s a middle ground between high-level database handling and a low-level generic function call.
The two methods added are

public function haveTermInDatabase($term, $term_id, array $args = array());

public function seeTermInDatabase($criteria);

where a possible use case might be

<?php 
$I = new AcceptanceTester($scenario);

$I->am('an admin');
$I->wantTo('create and see a term');

$I->haveTermInDatabase('Some fancy category', 12, array('description' => 'Some fancy category description'));

$I->seeTermInDatabase(array('description' => 'Some fancy category description'));
$I->seeTermInDatabase(array('taxonomy' => 'category', 'term_id' => 12));
$I->seeTermInDatabase(array('name' => 'Some fancy category'));
$I->seeTermInDatabase(array('slug' => 'some-fancy-category'));

the haveTermInDatabase will interpolate some default values to keep the method signature and needed parameters as small as possible and will also take care of updating both the terms and term_taxonomy tables.

What’s not doing

The term_relationships table stores the relations between post and term objects and will not be updated. I’m considering the possibility of methods taking care of that but that’s not what the terms-related methods here will do.
More detail about WordPress default tables here.

Next

I might tackle the term_relationships table and will surely move to the comments one.

I appreciate your input