WC_Install::check_version PHP Method

check_version() public static method

This check is done on all requests and runs if he versions do not match.
public static check_version ( )
    public static function check_version()
    {
        if (!defined('IFRAME_REQUEST') && get_option('woocommerce_version') !== WC()->version) {
            self::install();
            do_action('woocommerce_updated');
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Test check version.
  */
 public function test_check_version()
 {
     update_option('woocommerce_version', WC()->version - 1);
     update_option('woocommerce_db_version', WC()->version);
     WC_Install::check_version();
     $this->assertTrue(did_action('woocommerce_updated') === 1);
     update_option('woocommerce_version', WC()->version);
     update_option('woocommerce_db_version', WC()->version);
     WC_Install::check_version();
     $this->assertTrue(did_action('woocommerce_updated') === 1);
 }