Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Make test work with strict comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Sep 14, 2019
1 parent 5521a8e commit 2ed5f75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/Unit/Filter/BooleanFilterTest.php
Expand Up @@ -56,8 +56,8 @@ public function testFilterEmptyArrayDataWithMeaninglessValue(): void
public function getFilters()
{
return [
['eq', BooleanType::TYPE_YES, 1],
['eq', BooleanType::TYPE_NO, 0],
['eq', BooleanType::TYPE_YES, true],
['eq', BooleanType::TYPE_NO, false],
];
}

Expand Down
10 changes: 7 additions & 3 deletions tests/Unit/Filter/DateFilterTest.php
Expand Up @@ -77,7 +77,11 @@ public function testFilterSwitch($operatorMethod, $choiceType, $expectedValue =

$this->assertSame('a', $opDynamic->getAlias());
$this->assertSame('somefield', $opDynamic->getField());
$this->assertSame($expectedValue, $opStatic->getValue());
$this->assertTrue(
$expectedValue instanceof \DateTimeInterface ?
$expectedValue->getTimestamp() === $opStatic->getValue()->getTimestamp() :
$expectedValue === $opStatic->getValue()
);

$this->assertTrue($this->filter->isActive());
}
Expand All @@ -102,7 +106,7 @@ public function testFilterEquals(): void

$this->assertSame('a', $opDynamic->getAlias());
$this->assertSame('somefield', $opDynamic->getField());
$this->assertSame($from, $opStatic->getValue());
$this->assertSame($from->getTimestamp(), $opStatic->getValue()->getTimestamp());

// TO
$opDynamic = $this->qbTester->getNode(
Expand All @@ -112,7 +116,7 @@ public function testFilterEquals(): void

$this->assertSame('a', $opDynamic->getAlias());
$this->assertSame('somefield', $opDynamic->getField());
$this->assertSame($to, $opStatic->getValue());
$this->assertSame($to->getTimestamp(), $opStatic->getValue()->getTimestamp());

$this->assertTrue($this->filter->isActive());
}
Expand Down

0 comments on commit 2ed5f75

Please sign in to comment.