Files
yii2-usuario/tests/unit/TimeZoneTest.php
Leonardo Forconi 1c1ce6ccff
Some checks failed
Build / build (ubuntu-latest, 7.4) (push) Has been cancelled
Build / build (ubuntu-latest, 8.0) (push) Has been cancelled
Build / build (ubuntu-latest, 8.1) (push) Has been cancelled
Build / build (ubuntu-latest, 8.2) (push) Has been cancelled
Build / build (ubuntu-latest, 8.3) (push) Has been cancelled
Build / build (ubuntu-latest, 8.4) (push) Has been cancelled
refactor: renamed namespace from Da\User to pcrt\User
All PHP namespaces and related references have been updated from Da\User to pcrt\User throughout the codebase, including composer.json autoload settings and all source files. This change standardizes the project under the new pcrt\User namespace for improved clarity and maintainability.
2025-10-15 10:22:32 +02:00

27 lines
828 B
PHP

<?php
use pcrt\User\Helper\TimezoneHelper;
use pcrt\User\Validator\TimeZoneValidator;
use yii\helpers\ArrayHelper;
/**
* Testing the Timezone generator functions
*/
class TimeZoneTest extends \Codeception\Test\Unit
{
// Basic test to check the function works
public function testTimezoneHelper()
{
$alltz = (new TimezoneHelper)->getAll();
$this->assertTrue(in_array("Europe/Rome", ArrayHelper::getColumn($alltz, "timezone")));
$this->assertTrue(in_array("0100", ArrayHelper::getColumn($alltz, "offset")));
}
// Test with minPasswordRequirements equal to an empty array (= password without requirements)
public function testTimeZoneValidator()
{
$v = Yii::createObject(TimeZoneValidator::class, ["Europe/Rome"]);
$this->assertTrue($v->validate());
}
}