/**
  * @dataProvider remainingMessagesProvider
  * @param int $remaining
  * @param bool $expected
  */
 public function testRemainingMessagesBelowThreshold($remaining, $expected)
 {
     $accountNotifications = $this->getMockBuilder('Esendex_Sms_Model_AccountNotifications')->setMethods(array('getWarnLimit'))->getMock();
     $accountNotifications->expects($this->once())->method('getWarnLimit')->will($this->returnValue(20));
     $account = new Account();
     $account->messagesRemaining($remaining);
     $this->assertEquals($expected, $accountNotifications->remainingMessagesBelowThreshold($account));
 }
Ejemplo n.º 2
0
 private function parseAccount($account)
 {
     $result = new Account();
     $result->id($account["id"]);
     $result->reference($account->reference);
     $result->label($account->label);
     $result->address($account->address);
     $result->alias($account->alias);
     $result->type($account->type);
     $result->messagesRemaining(intval($account->messagesremaining, 10));
     $result->expiresOn($this->parseDateTime($account->expireson));
     $result->defaultDialCode($account->defaultdialcode);
     return $result;
 }
 /**
  * @param Account $account
  *
  * @return bool
  */
 public function remainingMessagesBelowThreshold(Account $account)
 {
     return $account->messagesRemaining() <= $this->getWarnLimit();
 }