dimanche 16 août 2020

How to test load_plugin_text_domain in wordpress using PHPunit

I am using PHPunit to test my plugin, in one of method I run function

load_plugin_textdomain( 'user-table', false, plugin_dir_path( __FILE__ ) . '/languages' );

to load the text domain of the plugin, but this function not include specific .mo files but just use the folder of mo files, so if I use

is_textdomain_loaded( 'user-table' );

to test, its not working and just return false always. But if use specific mo file using

load_textdomain( 'user-table', plugin_dir_path( __FILE__ ) . '/languages/default.mo' );

its working.

So my question is there a way to test load_plugin_textdomain() function?

Aucun commentaire:

Enregistrer un commentaire