Skip to content

Commit

Permalink
fixing datetime tests on php7.1
Browse files Browse the repository at this point in the history
- related to issue #600
  • Loading branch information
Mykhailo committed Dec 30, 2016
1 parent 0f71ad3 commit 67792db
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testBeforeSave()
$this->assertNotNull($address->getCreated());
$this->assertNotNull($address->getUpdated());

$this->assertEquals($address->getCreated(), $address->getUpdated());
$this->assertEquals($address->getCreated(), $address->getUpdated(), '', 1);
}

public function testGetRegionName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testBeforeSave()
$this->assertEquals(false, $entity->getBodyIsText());
$this->assertEquals(false, $entity->getHasAttachments());
$this->assertEquals(false, $entity->getPersistent());
$this->assertGreaterThanOrEqual($createdAt, $entity->getCreated());
$this->assertGreaterThanOrEqual($entity->getCreated(), $createdAt);
}

public function testTextBodyGetterAndSetter()
Expand Down
2 changes: 1 addition & 1 deletion src/Oro/Bundle/EmailBundle/Tests/Unit/Entity/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function testBeforeSave()
$createdAt = new \DateTime('now', new \DateTimeZone('UTC'));

$this->assertEquals(Email::NORMAL_IMPORTANCE, $entity->getImportance());
$this->assertGreaterThanOrEqual($createdAt, $entity->getCreated());
$this->assertGreaterThanOrEqual($entity->getCreated(), $createdAt);
}

public function testIsHeadGetterAndSetter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testBeforeSave()
$createdAt = new \DateTime('now', new \DateTimeZone('UTC'));

$this->assertEquals(Email::NORMAL_IMPORTANCE, $entity->getImportance());
$this->assertGreaterThanOrEqual($createdAt, $entity->getCreated());
$this->assertGreaterThanOrEqual($entity->getCreated(), $createdAt);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ public function testBindValidData($formData, $expectedViewData, $expectedModelDa
*/
public function setDataProvider()
{
$tokenDateTime = new \DateTime();

return [
'should have only accountType field' => [
[
Expand Down Expand Up @@ -188,7 +190,7 @@ public function setDataProvider()
'imapHost' => '',
'imapPort' => '',
'imapEncryption' => '',
'accessTokenExpiresAt' => new \DateTime(),
'accessTokenExpiresAt' => $tokenDateTime,
'accessToken' => 'token',
'googleAuthCode' => 'googleAuthCode'
],
Expand All @@ -197,7 +199,7 @@ public function setDataProvider()
'accountType' => 'gmail',
'userEmailOrigin' => $this->getUserEmailOrigin([
'user' => 'test',
'accessTokenExpiresAt' => new \DateTime(),
'accessTokenExpiresAt' => $tokenDateTime,
'googleAuthCode' => 'googleAuthCode',
'accessToken' => 'token',
])
Expand All @@ -206,7 +208,7 @@ public function setDataProvider()
'accountType' => 'gmail',
'userEmailOrigin' => $this->getUserEmailOrigin([
'user' => 'test',
'accessTokenExpiresAt' => new \DateTime(),
'accessTokenExpiresAt' => $tokenDateTime,
'googleAuthCode' => 'googleAuthCode',
'accessToken' => 'token'
])
Expand All @@ -220,7 +222,7 @@ public function setDataProvider()
'imapHost' => '',
'imapPort' => '',
'imapEncryption' => '',
'accessTokenExpiresAt' => new \DateTime(),
'accessTokenExpiresAt' => $tokenDateTime,
'accessToken' => '',
'googleAuthCode' => 'googleAuthCode',
'password' => '111'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ public function testBindValidData($formData, $expectedViewData, $expectedModelDa
*/
public function setDataProvider()
{
$tokenDateTime = new \DateTime();

return [
'should bind correct data' => [
[
Expand All @@ -151,7 +153,7 @@ public function setDataProvider()
'smtpHost' => 'smtp.gmail.com',
'smtpPort' => '993',
'smtpEncryption' => 'ssl',
'accessTokenExpiresAt' => new \DateTime(),
'accessTokenExpiresAt' => $tokenDateTime,
'accessToken' => '1',
'refreshToken' => '111'
],
Expand All @@ -163,7 +165,7 @@ public function setDataProvider()
'smtpHost' => 'smtp.gmail.com',
'smtpPort' => '993',
'smtpEncryption' => 'ssl',
'accessTokenExpiresAt' => new \DateTime(),
'accessTokenExpiresAt' => $tokenDateTime,
'accessToken' => '1',
'refreshToken' => '111'
],
Expand All @@ -175,7 +177,7 @@ public function setDataProvider()
'smtpHost' => 'smtp.gmail.com',
'smtpPort' => '993',
'smtpEncryption' => 'ssl',
'accessTokenExpiresAt' => new \DateTime(),
'accessTokenExpiresAt' => $tokenDateTime,
'accessToken' => '1',
'refreshToken' => '111'
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function ($logEntity) use ($message, $date) {
$this->assertEquals($logEntity->getSender(), 'test <[email protected]>');
$this->assertEquals($logEntity->getSubject(), 'test subject');
$this->assertEquals($logEntity->getBody(), 'test body');
$this->assertEquals($logEntity->getScheduledAt(), $date);
$this->assertEquals($logEntity->getScheduledAt(), $date, '', 1);
$this->assertEquals($logEntity->getStatus(), MassNotification::STATUS_SUCCESS);

return true;
Expand Down

0 comments on commit 67792db

Please sign in to comment.