Informática Asociada ia doc & examples: templates Documentation Index Examples List


/iaLib/ia_examples/ia/Math/Permutation_example.php


<?php $ia_example = [ 'title' => 'ia\Math\Permutation', // fully qualified className 'summary' => '', // class summary 'full_example' => '', // full usage example, relative path from ia_examples, blank '' not shown. 'example_file' => 'code/ia/Math/Permutation_example_code.php', // method by method example, blank '' not shown. ]; include( __DIR__ . '/../../template/ia_example_class.php');

/iaLib/ia_examples/code/ia/Math/Permutation_example_code.php


use ia\Math\Permutation; 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">'; ///////// Permutation::permutationsCount(3); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_permutationsCount'><b>Permutation::permutationsCount(<span class="type">int</span> \$numberOfElements, <span class="type">int</span> \$numberInPermutation <span class="default">= null</span>) <span>: int</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Math\Permutation", "permutationsCount")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>Permutation::permutationsCount(3); -&gt;&nbsp; DOCUMENT_EXAMPLE; /// run /// echo Permutation::permutationsCount(3); echo '</ol>'; ///////// Permutation::permutations(['a' => '1', 'b' => '2', 'c' => 3]); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_permutations'><b>Permutation::permutations(<span class="type">array</span> \$set, <span class="type"></span> \$numberInPermutation <span class="default">= null</span>) <span>: </span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Math\Permutation", "permutations")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>Permutation::permutations(['a' => '1', 'b' => '2', 'c' => 3]); -&gt;&nbsp; </b><br><pre> DOCUMENT_EXAMPLE; /// run /// print_r( Permutation::permutations(['a' => '1', 'b' => '2', 'c' => 3]) ); 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\Math\Permutation; use PHPUnit\Framework\TestCase; class PermutationTest extends TestCase { /** * @dataProvider permutationsCount_Provider * */ public function test_permutationsCount($numberOfElements, $numberInPermutation , $expected) { $this->assertEquals($expected, Permutation::permutationsCount($numberOfElements, $numberInPermutation) ); } function permutationsCount_Provider() { return [ 'test 1' => [ '', '', '' ], ]; } /** * @dataProvider permutations_Provider * */ public function test_permutations($set, $numberInPermutation , $expected) { $this->assertEquals($expected, Permutation::permutations($set, $numberInPermutation) ); } function permutations_Provider() { return [ 'test 1' => [ '', '', '' ], ]; } }

ia Doc