/iaLib/ia_examples/ia/DocumentIt/PerfilExample_example.php
<?php
$ia_example = [
'title' => 'ia\DocumentIt\PerfilExample', // fully qualified className
'summary' => '', // class summary
'full_example' => '', // full usage example, relative path from ia_examples, blank '' not shown.
'example_file' => 'code/ia/DocumentIt/PerfilExample_example_code.php', // method by method example, blank '' not shown.
];
include( __DIR__ . '/../../template/ia_example_class.php');
/iaLib/ia_examples/code/ia/DocumentIt/PerfilExample_example_code.php
use ia\DocumentIt\PerfilExample;
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>
/**
* PerfilExample constructor.
* @param string \$className
* @param string \$exampleDir
* @param string \$exampleHome
*/
/*
\$perfilExample = new PerfilExample(<span class="type">string</span> \$className, <span class="type">string</span> \$exampleDir, <span class="type">string</span> \$exampleHome);
*/
\$perfilExample = new PerfilExample('palabra', 'palabra', 'palabra');
</pre>
CONSTRUCTOR_PROTOTYPE;
$perfilExample = new PerfilExample('palabra', 'palabra', 'palabra');
echo '<ul class="usage">';
///////// \$perfilExample->getFileSystemControllerPath(); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_getFileSystemControllerPath'><b>\$perfilExample->getFileSystemControllerPath() <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\DocumentIt\PerfilExample", "getFileSystemControllerPath")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$perfilExample->getFileSystemControllerPath();
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$perfilExample->getFileSystemControllerPath()
);
echo "</pre>";
echo '</ol>';
///////// \$perfilExample->getFileSystemCodePath(); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_getFileSystemCodePath'><b>\$perfilExample->getFileSystemCodePath() <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\DocumentIt\PerfilExample", "getFileSystemCodePath")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$perfilExample->getFileSystemCodePath();
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$perfilExample->getFileSystemCodePath()
);
echo "</pre>";
echo '</ol>';
///////// \$perfilExample->directoryPath(null /* == */); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_directoryPath'><b>\$perfilExample->directoryPath(<span class="type"></span> \$fileName) <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\DocumentIt\PerfilExample", "directoryPath")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$perfilExample->directoryPath(null /* == */);
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$perfilExample->directoryPath(null /* == */)
);
echo "</pre>";
echo '</ol>';
///////// \$perfilExample->PerfilExample_class(); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_PerfilExample_class'><b>\$perfilExample->PerfilExample_class() <span>: string</span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\DocumentIt\PerfilExample", "PerfilExample_class")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$perfilExample->PerfilExample_class(); ->
DOCUMENT_EXAMPLE;
/// run ///
echo $perfilExample->PerfilExample_class();
echo '</ol>';
///////// \$perfilExample->testTemplate(); //////////////////////////////////////////////////
echo <<< FUNCTIONDEF
<li id='u_testTemplate'><b>\$perfilExample->testTemplate() <span>: </span></b>
FUNCTIONDEF;
echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\DocumentIt\PerfilExample", "testTemplate")."</pre>";
echo "<ol class='usage'>";
/// display ///
echo <<< DOCUMENT_EXAMPLE
<li>\$perfilExample->testTemplate();
-> </b><br><pre>
DOCUMENT_EXAMPLE;
/// run ///
print_r(
$perfilExample->testTemplate()
);
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\DocumentIt\PerfilExample;
use PHPUnit\Framework\TestCase;
class PerfilExampleTest extends TestCase {
/**
* @dataProvider getFileSystemControllerPath_Provider
*
*/
public function test_getFileSystemControllerPath( $expected) {
$perfilExample = new PerfilExample($className, $exampleDir, $exampleHome);
$this->assertEquals($expected, $perfilExample->getFileSystemControllerPath() );
}
function getFileSystemControllerPath_Provider() {
return [
'test 1' => [ '' ],
];
}
/**
* @dataProvider getFileSystemCodePath_Provider
*
*/
public function test_getFileSystemCodePath( $expected) {
$perfilExample = new PerfilExample($className, $exampleDir, $exampleHome);
$this->assertEquals($expected, $perfilExample->getFileSystemCodePath() );
}
function getFileSystemCodePath_Provider() {
return [
'test 1' => [ '' ],
];
}
/**
* @dataProvider directoryPath_Provider
*
*/
public function test_directoryPath($fileName , $expected) {
$perfilExample = new PerfilExample($className, $exampleDir, $exampleHome);
$this->assertEquals($expected, $perfilExample->directoryPath($fileName) );
}
function directoryPath_Provider() {
return [
'test 1' => [ '', '' ],
];
}
/**
* @dataProvider PerfilExample_class_Provider
*
*/
public function test_PerfilExample_class( $expected) {
$perfilExample = new PerfilExample($className, $exampleDir, $exampleHome);
$this->assertEquals($expected, $perfilExample->PerfilExample_class() );
}
function PerfilExample_class_Provider() {
return [
'test 1' => [ '' ],
];
}
/**
* @dataProvider testTemplate_Provider
*
*/
public function test_testTemplate( $expected) {
$perfilExample = new PerfilExample($className, $exampleDir, $exampleHome);
$this->assertEquals($expected, $perfilExample->testTemplate() );
}
function testTemplate_Provider() {
return [
'test 1' => [ '' ],
];
}
}
ia Doc