PHP code example of otgs / unit-tests-framework

1. Go to this page and download the library: Download otgs/unit-tests-framework library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

otgs / unit-tests-framework example snippets


$wpdb = $this->stubs->wpdb();  
$wpdb->method( 'get_var' )->willReturn( 1 );

$results = array(
	array( 'translation_id' => 1, 'element_id' => 1, 'language_code' => 'en', 'source_language_code' => null, 'trid' => 1, 'element_type' => 'post_page' ),
	array( 'translation_id' => 2, 'element_id' => 2, 'language_code' => 'fr', 'source_language_code' => 'en', 'trid' => 1, 'element_type' => 'post_page' ),
);
$wpdb = $this->this->wpdb();
$wpdb->expects( $this->exactly( 2 ) )->method( 'get_results' )->willReturn( $results );