/iaLib/ia_examples/ia/Sql/Mysql/CommonQueries_example.php
<?php
$ia_example = [
'title' => 'ia\Sql\Mysql\CommonQueries', // fully qualified className
'summary' => '', // class summary
'full_example' => '', // full usage example, relative path from ia_examples, blank '' not shown.
'example_file' => 'code/ia/Sql/Mysql/CommonQueries_example_code.php', // method by method example, blank '' not shown.
];
include( __DIR__ . '/../../../template/ia_example_class.php');
/iaLib/ia_examples/code/ia/Sql/Mysql/CommonQueries_example_code.php
use ia\Sql\Mysql\CommonQueries;
use ia\DocumentIt\DocumentIt;
echo '<h3>Disclaimer: Auto generated file.
Please help us setting parameters to useful values and extending the examples.
</h3>';
try {
echo <<< CONSTRUCTOR_PROTOTYPE
<pre>
/*
\$commonQueries = new CommonQueries(<span class="type"></span> \$db);
*/
\$commonQueries = new CommonQueries(null /* == */);
</pre>
CONSTRUCTOR_PROTOTYPE;
$commonQueries = new CommonQueries(null /* == */);
echo '<ul class="usage">';
///////// \$commonQueries->db_summary_echo(null /* == */); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_db_summary_echo'><b>\$commonQueries->db_summary_echo(<span class="type"></span> \$db_summary) <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Sql\Mysql\CommonQueries", "db_summary_echo")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$commonQueries->db_summary_echo(null /* == */);
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$commonQueries->db_summary_echo(null /* == */)
);
echo "</pre>";
echo '</ol>';
///////// \$commonQueries->db_summary(); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_db_summary'><b>\$commonQueries->db_summary() <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Sql\Mysql\CommonQueries", "db_summary")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$commonQueries->db_summary();
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$commonQueries->db_summary()
);
echo "</pre>";
echo '</ol>';
/* PerfilExample adds new methods here */
echo '</ul>';
} catch(Exception $exception) { echo "<pre class='errorBlock'>$exception</pre>"; }
phpunit test file template
<?php
use ia\Sql\Mysql\CommonQueries;
use PHPUnit\Framework\TestCase;
class CommonQueriesTest extends TestCase {
/**
* @dataProvider db_summary_echo_Provider
*
*/
public function test_db_summary_echo($db_summary , $expected) {
$commonQueries = new CommonQueries($db);
$this->assertEquals($expected, $commonQueries->db_summary_echo($db_summary) );
}
function db_summary_echo_Provider() {
return [
'test 1' => [ '', '' ],
];
}
/**
* @dataProvider db_summary_Provider
*
*/
public function test_db_summary( $expected) {
$commonQueries = new CommonQueries($db);
$this->assertEquals($expected, $commonQueries->db_summary() );
}
function db_summary_Provider() {
return [
'test 1' => [ '' ],
];
}
}
ia Doc