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


/iaLib/ia_examples/ia/Work/WorkDay/WorkDay_example.php


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

/iaLib/ia_examples/code/ia/Work/WorkDay/WorkDay_example_code.php


use ia\Work\WorkDay\WorkDay; 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> /** * WorkDay::__construct() * * @param array \$holidaysTemplate * @param array \$weekDaySchedules * @return */ /* \$workDay = new WorkDay(<span class="type">array</span> \$holidaysTemplate <span class="default">= null</span>, <span class="type">array</span> \$weekDaySchedules <span class="default">= null</span>); */ \$workDay = new WorkDay(); </pre> CONSTRUCTOR_PROTOTYPE; $workDay = new WorkDay(); echo '<ul class="usage">'; ///////// \$workDay->is_workable(3); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_is_workable'><b>\$workDay->is_workable(<span class="type">string|int|DateTimeInterface</span> \$anyDate) <span>: bool</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Work\WorkDay\WorkDay", "is_workable")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>\$workDay->is_workable(3); -&gt;&nbsp; DOCUMENT_EXAMPLE; ///run /// echo ($workDay->is_workable(3) ? 'true' : 'false'); echo '</ol>'; ///////// \$workDay->is_holiday(3); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_is_holiday'><b>\$workDay->is_holiday(<span class="type">string|int|DateTimeInterface</span> \$anyDate) <span>: bool</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Work\WorkDay\WorkDay", "is_holiday")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>\$workDay->is_holiday(3); -&gt;&nbsp; DOCUMENT_EXAMPLE; ///run /// echo ($workDay->is_holiday(3) ? 'true' : 'false'); echo '</ol>'; ///////// \$workDay->get_markedDay(3); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_get_markedDay'><b>\$workDay->get_markedDay(<span class="type">string|int|DateTimeInterface</span> \$anyDate) <span>: null|array</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Work\WorkDay\WorkDay", "get_markedDay")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>\$workDay->get_markedDay(3); -&gt;&nbsp; </b><br><pre> DOCUMENT_EXAMPLE; /// run /// print_r( $workDay->get_markedDay(3) ); echo "</pre>"; echo '</ol>'; ///////// \$workDay->get_AllMarkedDays(); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_get_AllMarkedDays'><b>\$workDay->get_AllMarkedDays(<span class="type">int|null</span> \$year <span class="default">= null</span>) <span>: array</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Work\WorkDay\WorkDay", "get_AllMarkedDays")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>\$workDay->get_AllMarkedDays(); -&gt;&nbsp; </b><br><pre> DOCUMENT_EXAMPLE; /// run /// print_r( $workDay->get_AllMarkedDays() ); echo "</pre>"; echo '</ol>'; ///////// \$workDay->get_AllHolidays(); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_get_AllHolidays'><b>\$workDay->get_AllHolidays(<span class="type">int|null</span> \$year <span class="default">= null</span>) <span>: array</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Work\WorkDay\WorkDay", "get_AllHolidays")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>\$workDay->get_AllHolidays(); -&gt;&nbsp; </b><br><pre> DOCUMENT_EXAMPLE; /// run /// print_r( $workDay->get_AllHolidays() ); echo "</pre>"; echo '</ol>'; ///////// \$workDay->get_weekDaySchedule(); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_get_weekDaySchedule'><b>\$workDay->get_weekDaySchedule() <span>: array</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Work\WorkDay\WorkDay", "get_weekDaySchedule")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>\$workDay->get_weekDaySchedule(); -&gt;&nbsp; </b><br><pre> DOCUMENT_EXAMPLE; /// run /// print_r( $workDay->get_weekDaySchedule() ); echo "</pre>"; echo '</ol>'; ///////// \$workDay->get_holidaysTemplate(); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_get_holidaysTemplate'><b>\$workDay->get_holidaysTemplate() <span>: array</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Work\WorkDay\WorkDay", "get_holidaysTemplate")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>\$workDay->get_holidaysTemplate(); -&gt;&nbsp; </b><br><pre> DOCUMENT_EXAMPLE; /// run /// print_r( $workDay->get_holidaysTemplate() ); echo "</pre>"; echo '</ol>'; ///////// WorkDay::validateWorkHoursByWeekDay(['a' => '1', 'b' => '2', 'c' => 3]); ////////////////////////////////////////////////// echo <<< FUNCTIONDEF <li id='u_validateWorkHoursByWeekDay'><b>WorkDay::validateWorkHoursByWeekDay(<span class="type">array</span> \$workHoursByWeekDay) <span>: array</span></b> FUNCTIONDEF; echo "<pre class='docBlock'>".DocumentIt::methodDocBlockProtected("ia\Work\WorkDay\WorkDay", "validateWorkHoursByWeekDay")."</pre>"; echo "<ol class='usage'>"; /// display /// echo <<< DOCUMENT_EXAMPLE <li>WorkDay::validateWorkHoursByWeekDay(['a' => '1', 'b' => '2', 'c' => 3]); -&gt;&nbsp; </b><br><pre> DOCUMENT_EXAMPLE; /// run /// print_r( WorkDay::validateWorkHoursByWeekDay(['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\Work\WorkDay\WorkDay; use PHPUnit\Framework\TestCase; class WorkDayTest extends TestCase { /** * @dataProvider is_workable_Provider * */ public function test_is_workable($anyDate , $expected) { $workDay = new WorkDay($holidaysTemplate, $weekDaySchedules); $this->assertEquals($expected, $workDay->is_workable($anyDate) ); } function is_workable_Provider() { return [ 'test 1' => [ '', '' ], ]; } /** * @dataProvider is_holiday_Provider * */ public function test_is_holiday($anyDate , $expected) { $workDay = new WorkDay($holidaysTemplate, $weekDaySchedules); $this->assertEquals($expected, $workDay->is_holiday($anyDate) ); } function is_holiday_Provider() { return [ 'test 1' => [ '', '' ], ]; } /** * @dataProvider get_markedDay_Provider * */ public function test_get_markedDay($anyDate , $expected) { $workDay = new WorkDay($holidaysTemplate, $weekDaySchedules); $this->assertEquals($expected, $workDay->get_markedDay($anyDate) ); } function get_markedDay_Provider() { return [ 'test 1' => [ '', '' ], ]; } /** * @dataProvider get_AllMarkedDays_Provider * */ public function test_get_AllMarkedDays($year , $expected) { $workDay = new WorkDay($holidaysTemplate, $weekDaySchedules); $this->assertEquals($expected, $workDay->get_AllMarkedDays($year) ); } function get_AllMarkedDays_Provider() { return [ 'test 1' => [ '', '' ], ]; } /** * @dataProvider get_AllHolidays_Provider * */ public function test_get_AllHolidays($year , $expected) { $workDay = new WorkDay($holidaysTemplate, $weekDaySchedules); $this->assertEquals($expected, $workDay->get_AllHolidays($year) ); } function get_AllHolidays_Provider() { return [ 'test 1' => [ '', '' ], ]; } /** * @dataProvider get_weekDaySchedule_Provider * */ public function test_get_weekDaySchedule( $expected) { $workDay = new WorkDay($holidaysTemplate, $weekDaySchedules); $this->assertEquals($expected, $workDay->get_weekDaySchedule() ); } function get_weekDaySchedule_Provider() { return [ 'test 1' => [ '' ], ]; } /** * @dataProvider get_holidaysTemplate_Provider * */ public function test_get_holidaysTemplate( $expected) { $workDay = new WorkDay($holidaysTemplate, $weekDaySchedules); $this->assertEquals($expected, $workDay->get_holidaysTemplate() ); } function get_holidaysTemplate_Provider() { return [ 'test 1' => [ '' ], ]; } /** * @dataProvider validateWorkHoursByWeekDay_Provider * */ public function test_validateWorkHoursByWeekDay($workHoursByWeekDay , $expected) { $this->assertEquals($expected, WorkDay::validateWorkHoursByWeekDay($workHoursByWeekDay) ); } function validateWorkHoursByWeekDay_Provider() { return [ 'test 1' => [ '', '' ], ]; } }

ia Doc