/iaLib/ia_examples/ia/JqGrid/JqGridRead_example.php
<?php
$ia_example = [
'title' => 'ia\JqGrid\JqGridRead', // fully qualified className
'summary' => '', // class summary
'full_example' => '', // full usage example, relative path from ia_examples, blank '' not shown.
'example_file' => 'code/ia/JqGrid/JqGridRead_example_code.php', // method by method example, blank '' not shown.
];
include( __DIR__ . '/../../template/ia_example_class.php');
/iaLib/ia_examples/code/ia/JqGrid/JqGridRead_example_code.php
use ia\JqGrid\JqGridRead;
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>
/*
\$jqGridRead = new JqGridRead(<span class="type"></span> \$db);
*/
\$jqGridRead = new JqGridRead(null /* == */);
</pre>
CONSTRUCTOR_PROTOTYPE;
$jqGridRead = new JqGridRead(null /* == */);
echo '<ul class="usage">';
///////// \$jqGridRead->respond(null /* == */, null /* == */); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_respond'><b>\$jqGridRead->respond(<span class="type"></span> \$sql, <span class="type"></span> \$sql_count) <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\JqGrid\JqGridRead", "respond")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$jqGridRead->respond(null /* == */, null /* == */);
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$jqGridRead->respond(null /* == */, null /* == */)
);
echo "</pre>";
echo '</ol>';
///////// \$jqGridRead->respond_grid(null /* == */, null /* == */); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_respond_grid'><b>\$jqGridRead->respond_grid(<span class="type"></span> \$sql, <span class="type"></span> \$sql_count, <span class="type"></span> \$tieneWhere <span class="default">= false</span>) <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\JqGrid\JqGridRead", "respond_grid")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$jqGridRead->respond_grid(null /* == */, null /* == */);
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$jqGridRead->respond_grid(null /* == */, null /* == */)
);
echo "</pre>";
echo '</ol>';
///////// \$jqGridRead->get_oper(); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_get_oper'><b>\$jqGridRead->get_oper() <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\JqGrid\JqGridRead", "get_oper")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$jqGridRead->get_oper();
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$jqGridRead->get_oper()
);
echo "</pre>";
echo '</ol>';
///////// \$jqGridRead->get_where_clause(); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_get_where_clause'><b>\$jqGridRead->get_where_clause() <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\JqGrid\JqGridRead", "get_where_clause")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$jqGridRead->get_where_clause();
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$jqGridRead->get_where_clause()
);
echo "</pre>";
echo '</ol>';
///////// \$jqGridRead->get_select(null /* == */); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_get_select'><b>\$jqGridRead->get_select(<span class="type"></span> \$select, <span class="type"></span> \$tieneWhere <span class="default">= false</span>, <span class="type"></span> \$limit <span class="default">= true</span>) <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\JqGrid\JqGridRead", "get_select")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$jqGridRead->get_select(null /* == */);
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$jqGridRead->get_select(null /* == */)
);
echo "</pre>";
echo '</ol>';
///////// \$jqGridRead->get_order_by(); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_get_order_by'><b>\$jqGridRead->get_order_by() <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\JqGrid\JqGridRead", "get_order_by")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$jqGridRead->get_order_by();
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$jqGridRead->get_order_by()
);
echo "</pre>";
echo '</ol>';
///////// \$jqGridRead->get_limit(); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_get_limit'><b>\$jqGridRead->get_limit() <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\JqGrid\JqGridRead", "get_limit")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$jqGridRead->get_limit();
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$jqGridRead->get_limit()
);
echo "</pre>";
echo '</ol>';
///////// \$jqGridRead->set_total_records(null /* == */); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_set_total_records'><b>\$jqGridRead->set_total_records(<span class="type"></span> \$total_records) <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\JqGrid\JqGridRead", "set_total_records")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$jqGridRead->set_total_records(null /* == */);
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$jqGridRead->set_total_records(null /* == */)
);
echo "</pre>";
echo '</ol>';
///////// \$jqGridRead->get_response(); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_get_response'><b>\$jqGridRead->get_response() <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\JqGrid\JqGridRead", "get_response")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$jqGridRead->get_response();
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$jqGridRead->get_response()
);
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\JqGrid\JqGridRead;
use PHPUnit\Framework\TestCase;
class JqGridReadTest extends TestCase {
/**
* @dataProvider respond_Provider
*
*/
public function test_respond($sql, $sql_count , $expected) {
$jqGridRead = new JqGridRead($db);
$this->assertEquals($expected, $jqGridRead->respond($sql, $sql_count) );
}
function respond_Provider() {
return [
'test 1' => [ '', '', '' ],
];
}
/**
* @dataProvider respond_grid_Provider
*
*/
public function test_respond_grid($sql, $sql_count, $tieneWhere , $expected) {
$jqGridRead = new JqGridRead($db);
$this->assertEquals($expected, $jqGridRead->respond_grid($sql, $sql_count, $tieneWhere) );
}
function respond_grid_Provider() {
return [
'test 1' => [ '', '', '', '' ],
];
}
/**
* @dataProvider get_oper_Provider
*
*/
public function test_get_oper( $expected) {
$jqGridRead = new JqGridRead($db);
$this->assertEquals($expected, $jqGridRead->get_oper() );
}
function get_oper_Provider() {
return [
'test 1' => [ '' ],
];
}
/**
* @dataProvider get_where_clause_Provider
*
*/
public function test_get_where_clause( $expected) {
$jqGridRead = new JqGridRead($db);
$this->assertEquals($expected, $jqGridRead->get_where_clause() );
}
function get_where_clause_Provider() {
return [
'test 1' => [ '' ],
];
}
/**
* @dataProvider get_select_Provider
*
*/
public function test_get_select($select, $tieneWhere, $limit , $expected) {
$jqGridRead = new JqGridRead($db);
$this->assertEquals($expected, $jqGridRead->get_select($select, $tieneWhere, $limit) );
}
function get_select_Provider() {
return [
'test 1' => [ '', '', '', '' ],
];
}
/**
* @dataProvider get_order_by_Provider
*
*/
public function test_get_order_by( $expected) {
$jqGridRead = new JqGridRead($db);
$this->assertEquals($expected, $jqGridRead->get_order_by() );
}
function get_order_by_Provider() {
return [
'test 1' => [ '' ],
];
}
/**
* @dataProvider get_limit_Provider
*
*/
public function test_get_limit( $expected) {
$jqGridRead = new JqGridRead($db);
$this->assertEquals($expected, $jqGridRead->get_limit() );
}
function get_limit_Provider() {
return [
'test 1' => [ '' ],
];
}
/**
* @dataProvider set_total_records_Provider
*
*/
public function test_set_total_records($total_records , $expected) {
$jqGridRead = new JqGridRead($db);
$this->assertEquals($expected, $jqGridRead->set_total_records($total_records) );
}
function set_total_records_Provider() {
return [
'test 1' => [ '', '' ],
];
}
/**
* @dataProvider get_response_Provider
*
*/
public function test_get_response( $expected) {
$jqGridRead = new JqGridRead($db);
$this->assertEquals($expected, $jqGridRead->get_response() );
}
function get_response_Provider() {
return [
'test 1' => [ '' ],
];
}
}
ia Doc