Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b63724f78 | ||
|
|
bd753998df | ||
|
|
0c923ba77e | ||
|
|
fde200b377 | ||
|
|
521a7f5530 | ||
|
|
651c82bede | ||
|
|
936dc47ae2 | ||
|
|
214e23b1a0 | ||
|
|
7e6774dd71 | ||
|
|
6642295a0e | ||
|
|
dec9cdb8a9 |
No files matched your search
@@ -4,11 +4,11 @@ on: [push]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
php-cs-fixer:
|
php-cs-fixer:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
|
|
||||||
@@ -18,6 +18,6 @@ jobs:
|
|||||||
args: --config=.php_cs.dist.php --allow-risky=yes
|
args: --config=.php_cs.dist.php --allow-risky=yes
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
uses: stefanzweifel/git-auto-commit-action@v4
|
uses: stefanzweifel/git-auto-commit-action@v7
|
||||||
with:
|
with:
|
||||||
commit_message: Fix styling
|
commit_message: Fix styling
|
||||||
@@ -11,7 +11,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-24.04]
|
||||||
php: [8.0, 8.1, 8.2, '8.3', '8.4', '8.5']
|
php: [8.0, 8.1, 8.2, '8.3', '8.4', '8.5']
|
||||||
laravel: ['8.*', '9.*', '10.*', '13.*']
|
laravel: ['8.*', '9.*', '10.*', '13.*']
|
||||||
dependency-version: [prefer-lowest, prefer-stable]
|
dependency-version: [prefer-lowest, prefer-stable]
|
||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
@@ -46,6 +46,7 @@ jobs:
|
|||||||
php-version: ${{ matrix.php }}
|
php-version: ${{ matrix.php }}
|
||||||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
|
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
|
||||||
coverage: none
|
coverage: none
|
||||||
|
tools: composer:v2
|
||||||
|
|
||||||
- name: Setup problem matchers
|
- name: Setup problem matchers
|
||||||
run: |
|
run: |
|
||||||
@@ -55,6 +56,10 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
|
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
|
||||||
|
# PHPUnit 12+ no longer discovers the existing @test annotations.
|
||||||
|
composer require --dev "phpunit/phpunit:^9.5|^10.0|^11.0" --no-interaction --no-update
|
||||||
|
# Allow compatibility testing against older dependency versions in CI only.
|
||||||
|
composer config audit.block-insecure false
|
||||||
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
|
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
|
||||||
|
|
||||||
- name: Execute tests
|
- name: Execute tests
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ composer require hekmatinasser/verta
|
|||||||
<td>12.0</td>
|
<td>12.0</td>
|
||||||
<td>8.5</td>
|
<td>8.5</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>13.0</td>
|
||||||
|
<td>9</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -19,9 +19,9 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.0",
|
"php": "^8.0",
|
||||||
"illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",
|
"illuminate/support": ">=8.0",
|
||||||
"illuminate/validation": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",
|
"illuminate/validation": ">=8.0",
|
||||||
"hekmatinasser/jalali": "^8.2.3"
|
"hekmatinasser/jalali": "^8.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"orchestra/testbench": "^6.23|^7.0|^8.0|^11.0"
|
"orchestra/testbench": "^6.23|^7.0|^8.0|^11.0"
|
||||||
|
|||||||
+1
-6
@@ -1,10 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
|
<phpunit bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false">
|
||||||
<coverage>
|
|
||||||
<include>
|
|
||||||
<directory suffix=".php">src/</directory>
|
|
||||||
</include>
|
|
||||||
</coverage>
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Library Program Test Suite">
|
<testsuite name="Library Program Test Suite">
|
||||||
<directory suffix=".php">./tests/</directory>
|
<directory suffix=".php">./tests/</directory>
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ namespace Hekmatinasser\Verta;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Hekmatinasser\Jalali\Jalali;
|
use Hekmatinasser\Jalali\Jalali;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use Illuminate\Support\Traits\Macroable;
|
||||||
|
|
||||||
class Verta extends Jalali
|
class Verta extends Jalali
|
||||||
{
|
{
|
||||||
|
use Macroable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Carbon instance from Verta
|
* Create a Carbon instance from Verta
|
||||||
*
|
*
|
||||||
|
|||||||
+3
-3
@@ -5,11 +5,11 @@ use Hekmatinasser\Verta\Verta;
|
|||||||
|
|
||||||
if (! function_exists('verta')) {
|
if (! function_exists('verta')) {
|
||||||
/**
|
/**
|
||||||
* @param Jalali|DateTime|string|int|null $datetime
|
* @param DateTime|int|string|Jalali|null $datetime
|
||||||
* @param DateTimeZone|string|null $timezone
|
* @param DateTimeZone|string|null $timezone
|
||||||
* @return Verta
|
* @return Verta
|
||||||
*/
|
*/
|
||||||
function verta($datetime = null, $timezone = null): Verta
|
function verta(DateTime|int|string|Jalali $datetime = null, DateTimeZone|string $timezone = null): Verta
|
||||||
{
|
{
|
||||||
return new Verta($datetime, $timezone);
|
return new Verta($datetime, $timezone);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class FormatTest extends TestCase
|
|||||||
{
|
{
|
||||||
$datetime = Jalali::parse('1398-10-11 21:32:35')->formatWord('l d S F');
|
$datetime = Jalali::parse('1398-10-11 21:32:35')->formatWord('l d S F');
|
||||||
|
|
||||||
$this->assertEquals('چهارشنبه یازده ام دی', $datetime);
|
$this->assertEquals('چهارشنبه یازده م دی', $datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFormatQuarter()
|
public function testFormatQuarter()
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateByCorrectInput($date, $format = null)
|
public function validateDateByCorrectInput($date, $format = null)
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDate(null, $date, ! ! $format ? [$format] : [])
|
$this->jalaliValidator->validateDate('date', $date, ! ! $format ? [$format] : [])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateByIncorrectInput($date, $format = null)
|
public function validateDateByIncorrectInput($date, $format = null)
|
||||||
{
|
{
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDate(null, $date, ! ! $format ? [$format] : [])
|
$this->jalaliValidator->validateDate('date', $date, ! ! $format ? [$format] : [])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ class JalaliValidatorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateEqual(
|
$this->jalaliValidator->validateDateEqual(
|
||||||
null,
|
'date',
|
||||||
$date,
|
$date,
|
||||||
! ! $format ? [$date, $format] : [$date]
|
! ! $format ? [$date, $format] : [$date]
|
||||||
)
|
)
|
||||||
@@ -57,7 +57,7 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateEqualByIncorrectInput()
|
public function validateDateEqualByIncorrectInput()
|
||||||
{
|
{
|
||||||
$result = $this->jalaliValidator->validateDateEqual(
|
$result = $this->jalaliValidator->validateDateEqual(
|
||||||
null,
|
'date',
|
||||||
'1397/01/01',
|
'1397/01/01',
|
||||||
['1397/01/02']
|
['1397/01/02']
|
||||||
);
|
);
|
||||||
@@ -69,11 +69,11 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateNotEqual()
|
public function validateDateNotEqual()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateNotEqual(null, '1399/01/01', ['1399/01/02'])
|
$this->jalaliValidator->validateDateNotEqual('date', '1399/01/01', ['1399/01/02'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateNotEqual(null, '1399/01/01', ['1399/01/01'])
|
$this->jalaliValidator->validateDateNotEqual('date', '1399/01/01', ['1399/01/01'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function whenJalaliValidatorSecondArgumentIsEmpty($method)
|
public function whenJalaliValidatorSecondArgumentIsEmpty($method)
|
||||||
{
|
{
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->{$method}(null, [], [])
|
$this->jalaliValidator->{$method}('date', [], [])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,15 +166,15 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateTime()
|
public function validateDateTime()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateTime(null, "1398/01/01 20:00:00", [])
|
$this->jalaliValidator->validateDateTime('date', "1398/01/01 20:00:00", [])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateTime(null, "1398/01/01 20:00:00", ["Y/m/d H:i:s"])
|
$this->jalaliValidator->validateDateTime('date', "1398/01/01 20:00:00", ["Y/m/d H:i:s"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateTime(null, "1398/01/01", ["Y/m/d H:i:s"])
|
$this->jalaliValidator->validateDateTime('date', "1398/01/01", ["Y/m/d H:i:s"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,11 +182,11 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateTimeEqual()
|
public function validateDateTimeEqual()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateTimeEqual(null, "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
$this->jalaliValidator->validateDateTimeEqual('date', "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateTimeEqual(null, "1398/01/01 20:00:00", ["1398/01/01 20:00:01"])
|
$this->jalaliValidator->validateDateTimeEqual('date', "1398/01/01 20:00:00", ["1398/01/01 20:00:01"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,11 +194,11 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateTimeNotEqual()
|
public function validateDateTimeNotEqual()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateTimeNotEqual(null, "1398/01/01 20:00:00", ["1398/01/01 20:00:01"])
|
$this->jalaliValidator->validateDateTimeNotEqual('date', "1398/01/01 20:00:00", ["1398/01/01 20:00:01"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateTimeNotEqual(null, "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
$this->jalaliValidator->validateDateTimeNotEqual('date', "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,15 +206,15 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateAfter()
|
public function validateDateAfter()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateAfter(null, "1398/01/02", ["1398/01/01"])
|
$this->jalaliValidator->validateDateAfter('date', "1398/01/02", ["1398/01/01"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateAfter(null, "1398/01/01", ["1398/01/01"])
|
$this->jalaliValidator->validateDateAfter('date', "1398/01/01", ["1398/01/01"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateAfter(null, "1398/01/01", ["1398/01/02"])
|
$this->jalaliValidator->validateDateAfter('date', "1398/01/01", ["1398/01/02"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,15 +222,15 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateAfterEqual()
|
public function validateDateAfterEqual()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateAfterEqual(null, "1398/01/02", ["1398/01/01"])
|
$this->jalaliValidator->validateDateAfterEqual('date', "1398/01/02", ["1398/01/01"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateAfterEqual(null, "1398/01/01", ["1398/01/01"])
|
$this->jalaliValidator->validateDateAfterEqual('date', "1398/01/01", ["1398/01/01"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateAfterEqual(null, "1398/01/01", ["1398/01/02"])
|
$this->jalaliValidator->validateDateAfterEqual('date', "1398/01/01", ["1398/01/02"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,15 +238,15 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateTimeAfter()
|
public function validateDateTimeAfter()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateTimeAfter(null, "1398/01/02 20:00:00", ["1398/01/01 20:00:00"])
|
$this->jalaliValidator->validateDateTimeAfter('date', "1398/01/02 20:00:00", ["1398/01/01 20:00:00"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateTimeAfter(null, "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
$this->jalaliValidator->validateDateTimeAfter('date', "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateTimeAfter(null, "1398/01/01 20:00:00", ["1398/01/02 20:00:00"])
|
$this->jalaliValidator->validateDateTimeAfter('date', "1398/01/01 20:00:00", ["1398/01/02 20:00:00"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,15 +254,15 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateTimeAfterEqual()
|
public function validateDateTimeAfterEqual()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateTimeAfterEqual(null, "1398/01/02 20:00:00", ["1398/01/01 20:00:00"])
|
$this->jalaliValidator->validateDateTimeAfterEqual('date', "1398/01/02 20:00:00", ["1398/01/01 20:00:00"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateTimeAfterEqual(null, "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
$this->jalaliValidator->validateDateTimeAfterEqual('date', "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateTimeAfterEqual(null, "1398/01/01 20:00:00", ["1398/01/02 20:00:00"])
|
$this->jalaliValidator->validateDateTimeAfterEqual('date', "1398/01/01 20:00:00", ["1398/01/02 20:00:00"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,15 +270,15 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateBefore()
|
public function validateDateBefore()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateBefore(null, "1398/01/01", ["1398/01/02"])
|
$this->jalaliValidator->validateDateBefore('date', "1398/01/01", ["1398/01/02"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateBefore(null, "1398/01/01", ["1398/01/01"])
|
$this->jalaliValidator->validateDateBefore('date', "1398/01/01", ["1398/01/01"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateBefore(null, "1398/01/02", ["1398/01/01"])
|
$this->jalaliValidator->validateDateBefore('date', "1398/01/02", ["1398/01/01"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,15 +286,15 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateBeforeEqual()
|
public function validateDateBeforeEqual()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateBeforeEqual(null, "1398/01/01", ["1398/01/02"])
|
$this->jalaliValidator->validateDateBeforeEqual('date', "1398/01/01", ["1398/01/02"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateBeforeEqual(null, "1398/01/01", ["1398/01/01"])
|
$this->jalaliValidator->validateDateBeforeEqual('date', "1398/01/01", ["1398/01/01"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateBeforeEqual(null, "1398/01/05", ["1398/01/01"])
|
$this->jalaliValidator->validateDateBeforeEqual('date', "1398/01/05", ["1398/01/01"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,15 +302,15 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateTimeBefore()
|
public function validateDateTimeBefore()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateTimeBefore(null, "1398/01/01 20:00:00", ["1398/01/02 20:00:00"])
|
$this->jalaliValidator->validateDateTimeBefore('date', "1398/01/01 20:00:00", ["1398/01/02 20:00:00"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateTimeBefore(null, "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
$this->jalaliValidator->validateDateTimeBefore('date', "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateTimeBefore(null, "1398/01/02 20:00:00", ["1398/01/01 20:00:00"])
|
$this->jalaliValidator->validateDateTimeBefore('date', "1398/01/02 20:00:00", ["1398/01/01 20:00:00"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,15 +318,15 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function validateDateTimeBeforeEqual()
|
public function validateDateTimeBeforeEqual()
|
||||||
{
|
{
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateTimeBeforeEqual(null, "1398/01/01 20:00:00", ["1398/01/02 20:00:00"])
|
$this->jalaliValidator->validateDateTimeBeforeEqual('date', "1398/01/01 20:00:00", ["1398/01/02 20:00:00"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$this->jalaliValidator->validateDateTimeBeforeEqual(null, "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
$this->jalaliValidator->validateDateTimeBeforeEqual('date', "1398/01/01 20:00:00", ["1398/01/01 20:00:00"])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$this->jalaliValidator->validateDateTimeBeforeEqual(null, "1398/01/02 20:00:00", ["1398/01/01 20:00:00"])
|
$this->jalaliValidator->validateDateTimeBeforeEqual('date', "1398/01/02 20:00:00", ["1398/01/01 20:00:00"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ class JalaliValidatorTest extends TestCase
|
|||||||
public function replaceDateOrDatetime()
|
public function replaceDateOrDatetime()
|
||||||
{
|
{
|
||||||
$text = "hello world!";
|
$text = "hello world!";
|
||||||
$result = $this->jalaliValidator->replaceDateOrDatetime($text, null, null, null);
|
$result = $this->jalaliValidator->replaceDateOrDatetime($text, 'date', 'jdate', []);
|
||||||
$this->assertEquals($text, $result);
|
$this->assertEquals($text, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,10 +343,10 @@ class JalaliValidatorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$message = "The :attribute is not equal Jalali date :date";
|
$message = "The :attribute is not equal Jalali date :date";
|
||||||
Verta::setLocale("en");
|
Verta::setLocale("en");
|
||||||
$result = $this->jalaliValidator->replaceDateAfterOrBeforeOrEqual($message, null, null, [$date = "1398/01/01", "Y-m-d"]);
|
$result = $this->jalaliValidator->replaceDateAfterOrBeforeOrEqual($message, 'date', 'jdate_equal', [$date = "1398/01/01", "Y-m-d"]);
|
||||||
$this->assertEquals("The :attribute is not equal Jalali date {$date}", $result);
|
$this->assertEquals("The :attribute is not equal Jalali date {$date}", $result);
|
||||||
Verta::setLocale("fa");
|
Verta::setLocale("fa");
|
||||||
$result = $this->jalaliValidator->replaceDateAfterOrBeforeOrEqual($message, null, null, [$date = "1398/01/01", "Y-m-d"]);
|
$result = $this->jalaliValidator->replaceDateAfterOrBeforeOrEqual($message, 'date', 'jdate_equal', [$date = "1398/01/01", "Y-m-d"]);
|
||||||
$this->assertEquals("The :attribute is not equal Jalali date ۱۳۹۸/۰۱/۰۱", $result);
|
$this->assertEquals("The :attribute is not equal Jalali date ۱۳۹۸/۰۱/۰۱", $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user