/iaLib/ia_examples/ia/Util/XlsxUtil_example.php
<?php
$ia_example = [
'title' => 'ia\Util\XlsxUtil', // fully qualified className
'summary' => '', // class summary
'full_example' => '', // full usage example, relative path from ia_examples, blank '' not shown.
'example_file' => 'code/ia/Util/XlsxUtil_example_code.php', // method by method example, blank '' not shown.
];
include( __DIR__ . '/../../template/ia_example_class.php');
/iaLib/ia_examples/code/ia/Util/XlsxUtil_example_code.php
use ia\Util\XlsxUtil;
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 '<ul class="usage">';
///////// XlsxUtil::xlsx_sheetName_sanitize('palabra'); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_xlsx_sheetName_sanitize'><b>XlsxUtil::xlsx_sheetName_sanitize(<span class="type">string</span> \$sheet_name) <span>: string</span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Util\XlsxUtil", "xlsx_sheetName_sanitize")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>XlsxUtil::xlsx_sheetName_sanitize('palabra'); ->
DOCUMENT_EXAMPLE;
/// run ///
echo XlsxUtil::xlsx_sheetName_sanitize('palabra');
echo '</ol>';
///////// XlsxUtil::xlsx_colNum2colLetter(3); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_xlsx_colNum2colLetter'><b>XlsxUtil::xlsx_colNum2colLetter(<span class="type">int</span> \$colNum) <span>: string</span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Util\XlsxUtil", "xlsx_colNum2colLetter")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>XlsxUtil::xlsx_colNum2colLetter(3); ->
DOCUMENT_EXAMPLE;
/// run ///
echo XlsxUtil::xlsx_colNum2colLetter(3);
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\Util\XlsxUtil;
use PHPUnit\Framework\TestCase;
class XlsxUtilTest extends TestCase {
/**
* @dataProvider xlsx_sheetName_sanitize_Provider
*
*/
public function test_xlsx_sheetName_sanitize($sheet_name , $expected) {
$this->assertEquals($expected, XlsxUtil::xlsx_sheetName_sanitize($sheet_name) );
}
function xlsx_sheetName_sanitize_Provider() {
return [
'test 1' => [ '', '' ],
];
}
/**
* @dataProvider xlsx_colNum2colLetter_Provider
*
*/
public function test_xlsx_colNum2colLetter($colNum , $expected) {
$this->assertEquals($expected, XlsxUtil::xlsx_colNum2colLetter($colNum) );
}
function xlsx_colNum2colLetter_Provider() {
return [
'test 1' => [ '', '' ],
];
}
}
ia Doc