Skip to content

Commit

Permalink
EMAILCLOUD-470: Tests updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Marat-Gumerov committed Aug 15, 2023
1 parent 82d02cb commit 8706260
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 19 deletions.
84 changes: 78 additions & 6 deletions src/Aspose/Email/Model/CalendarDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class CalendarDto implements ArrayAccess
'summary' => 'string',
'transparency' => 'string',
'class' => 'string',
'microsoft_importance' => 'string'
'microsoft_importance' => 'string',
'html_description' => 'string',
'date_time_stamp' => '\DateTime'
];

/**
Expand Down Expand Up @@ -111,7 +113,9 @@ class CalendarDto implements ArrayAccess
'summary' => null,
'transparency' => null,
'class' => null,
'microsoft_importance' => null
'microsoft_importance' => null,
'html_description' => null,
'date_time_stamp' => 'date-time'
];

/**
Expand Down Expand Up @@ -164,7 +168,9 @@ public static function swaggerFormats()
'summary' => 'summary',
'transparency' => 'transparency',
'class' => 'class',
'microsoft_importance' => 'microsoftImportance'
'microsoft_importance' => 'microsoftImportance',
'html_description' => 'htmlDescription',
'date_time_stamp' => 'dateTimeStamp'
];

/**
Expand Down Expand Up @@ -196,7 +202,9 @@ public static function swaggerFormats()
'summary' => 'setSummary',
'transparency' => 'setTransparency',
'class' => 'setClass',
'microsoft_importance' => 'setMicrosoftImportance'
'microsoft_importance' => 'setMicrosoftImportance',
'html_description' => 'setHtmlDescription',
'date_time_stamp' => 'setDateTimeStamp'
];

/**
Expand Down Expand Up @@ -228,7 +236,9 @@ public static function swaggerFormats()
'summary' => 'getSummary',
'transparency' => 'getTransparency',
'class' => 'getClass',
'microsoft_importance' => 'getMicrosoftImportance'
'microsoft_importance' => 'getMicrosoftImportance',
'html_description' => 'getHtmlDescription',
'date_time_stamp' => 'getDateTimeStamp'
];

/**
Expand Down Expand Up @@ -310,6 +320,8 @@ public function getModelName()
* @param string $transparency Specifies whether or not this appointment is intended to be visible in availability searches. Enum, available values: NotDefined, Transparent, Opaque
* @param string $class Defines the access classification for the calendar. Enum, available values: Public, Private, Confidential, NotDefined
* @param string $microsoft_importance Specifies the importance of a calendar object. Enum, available values: Low, Normal, High, NotDefined
* @param string $html_description HTML representation of description.
* @param \DateTime $date_time_stamp Date/time that the instance of the iCalendar object was created.
*/
public function __construct(
$attachments = null,
Expand All @@ -335,7 +347,9 @@ public function __construct(
$summary = null,
$transparency = null,
$class = null,
$microsoft_importance = null
$microsoft_importance = null,
$html_description = null,
$date_time_stamp = null
) {
$this->container['attachments'] = null;
$this->container['attendees'] = null;
Expand All @@ -361,6 +375,8 @@ public function __construct(
$this->container['transparency'] = null;
$this->container['class'] = null;
$this->container['microsoft_importance'] = null;
$this->container['html_description'] = null;
$this->container['date_time_stamp'] = null;

if ($attachments != null) $this->setAttachments($attachments);
if ($attendees != null) $this->setAttendees($attendees);
Expand All @@ -386,6 +402,8 @@ public function __construct(
if ($transparency != null) $this->setTransparency($transparency);
if ($class != null) $this->setClass($class);
if ($microsoft_importance != null) $this->setMicrosoftImportance($microsoft_importance);
if ($html_description != null) $this->setHtmlDescription($html_description);
if ($date_time_stamp != null) $this->setDateTimeStamp($date_time_stamp);
}

/**
Expand Down Expand Up @@ -440,6 +458,9 @@ public function listInvalidProperties()
if ($this->container['microsoft_importance'] === null) {
$invalidProperties[] = "'microsoft_importance' can't be null";
}
if ($this->container['date_time_stamp'] === null) {
$invalidProperties[] = "'date_time_stamp' can't be null";
}
return $invalidProperties;
}

Expand Down Expand Up @@ -494,6 +515,9 @@ public function valid()
if ($this->container['microsoft_importance'] === null) {
return false;
}
if ($this->container['date_time_stamp'] === null) {
return false;
}
return true;
}

Expand Down Expand Up @@ -1076,6 +1100,54 @@ public function setMicrosoftImportance($microsoft_importance)

return $this;
}

/**
* Gets html_description
*
* @return string
*/
public function getHtmlDescription()
{
return $this->container['html_description'];
}

/**
* Sets html_description
*
* @param string $html_description HTML representation of description.
*
* @return $this
*/
public function setHtmlDescription($html_description)
{
$this->container['html_description'] = $html_description;

return $this;
}

/**
* Gets date_time_stamp
*
* @return \DateTime
*/
public function getDateTimeStamp()
{
return $this->container['date_time_stamp'];
}

/**
* Sets date_time_stamp
*
* @param \DateTime $date_time_stamp Date/time that the instance of the iCalendar object was created.
*
* @return $this
*/
public function setDateTimeStamp($date_time_stamp)
{
$this->container['date_time_stamp'] = $date_time_stamp;

return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
Expand Down
20 changes: 20 additions & 0 deletions src/Aspose/Email/Model/CalendarDtoBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,5 +304,25 @@ public function microsoftImportance($microsoftImportance)
$this->model->setMicrosoftImportance($microsoftImportance);
return $this;
}
/**
* Sets htmlDescription
* @param string $htmlDescription HTML representation of description.
* @return $this
*/
public function htmlDescription($htmlDescription)
{
$this->model->setHtmlDescription($htmlDescription);
return $this;
}
/**
* Sets dateTimeStamp
* @param \DateTime $dateTimeStamp Date/time that the instance of the iCalendar object was created.
* @return $this
*/
public function dateTimeStamp($dateTimeStamp)
{
$this->model->setDateTimeStamp($dateTimeStamp);
return $this;
}
}

4 changes: 2 additions & 2 deletions src/Aspose/Email/Model/MapiKnownPropertyDescriptor.php

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/Test/AiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function testAiBcrParseStorage(): void
self::$storage
));
$fileContent = $contactTempFile->fread($contactTempFile->getSize());
$this->assertRegExp("/Thomas/", $fileContent);
$this->assertMatchesRegularExpression("/Thomas/", $fileContent);
}

/**
Expand All @@ -163,6 +163,6 @@ public function testAiBcrParse(): void
));
$this->assertEquals(1, count($result->getValue()));
$displayName = $result->getValue()[0]->getDisplayName();
$this->assertRegExp("/Thomas/", $displayName);
$this->assertMatchesRegularExpression("/Thomas/", $displayName);
}
}
4 changes: 2 additions & 2 deletions tests/Test/CalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testCreateCalendarEmail(): void
new DownloadFileRequest(self::$folder . "/" . $emailFile, self::$storage)
);
$downloadedContent = $downloaded->fread($downloaded->getSize());
$this->assertRegExp("/[email protected]/", $downloadedContent);
$this->assertMatchesRegularExpression("/[email protected]/", $downloadedContent);
}

/**
Expand All @@ -76,7 +76,7 @@ public function testCalendarConverter(): void
//ICS is a text format. We can read it to a string and check that it
//contains specified location as a substring:
$fileContent = $ics->fread($ics->getSize());
$this->assertRegExp("/" . $calendarDto->getLocation() . "/", $fileContent);
$this->assertMatchesRegularExpression("/" . $calendarDto->getLocation() . "/", $fileContent);
//We can also convert the file back to a CalendarDto
$dto = $api->calendar()->fromFile(new CalendarFromFileRequest($ics));
$this->assertEquals($calendarDto->getLocation(), $dto->getLocation());
Expand Down
2 changes: 1 addition & 1 deletion tests/Test/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testContactConverter(): void
$mapi = $api->contact()->asFile(new ContactAsFileRequest('Msg', $contactDto));
$vcard = $api->contact()->convert(new ContactConvertRequest('VCard', 'Msg', $mapi));
$fileContent = $vcard->fread($vcard->getSize());
$this->assertRegExp("/" . $contactDto->getSurname() . "/", $fileContent);
$this->assertMatchesRegularExpression("/" . $contactDto->getSurname() . "/", $fileContent);
$dto = $api->contact()->fromFile(new ContactFromFileRequest('VCard', $vcard));
$this->assertEquals($contactDto->getSurname(), $dto->getSurname());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Test/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testEmailConverter(): void
$mapi = $api->email()->asFile(new EmailAsFileRequest('Msg', $emailDto));
$eml = $api->email()->convert(new EmailConvertRequest('Msg', 'Eml', $mapi));
$fileContent = $eml->fread($eml->getSize());
$this->assertRegExp("/" . $emailDto->getFrom()->getAddress() . "/", $fileContent);
$this->assertMatchesRegularExpression("/" . $emailDto->getFrom()->getAddress() . "/", $fileContent);
$dto = $api->email()->fromFile(new EmailFromFileRequest('Eml', $eml));
$this->assertEquals($emailDto->getFrom()->getAddress(), $dto->getFrom()->getAddress());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Test/MapiCalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testModelToFile(): void
$mapiCalendar
));
$fileContent = $ics->fread($ics->getSize());
$this->assertRegExp("/" . $mapiCalendar->getLocation() . "/", $fileContent);
$this->assertMatchesRegularExpression("/" . $mapiCalendar->getLocation() . "/", $fileContent);

$mapiCalendarConverted = $api->mapi()->calendar()->fromFile(new MapiCalendarFromFileRequest($ics));
$this->assertEquals($mapiCalendar->getLocation(), $mapiCalendarConverted->getLocation());
Expand Down
2 changes: 1 addition & 1 deletion tests/Test/MapiContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testModelToFile(): void
$mapiContact
));
$fileContent = $vcardFile->fread($vcardFile->getSize());
$this->assertRegExp("/" . $mapiContact->getNameInfo()->getGivenName() . "/", $fileContent);
$this->assertMatchesRegularExpression("/" . $mapiContact->getNameInfo()->getGivenName() . "/", $fileContent);
$mapiContactConverted = $api->mapi()->contact()->fromFile(new MapiContactFromFileRequest("VCard", $vcardFile));
$this->assertEquals($mapiContact->getNameInfo()->getSurname(), $mapiContactConverted
->getNameInfo()->getSurname());
Expand Down
2 changes: 1 addition & 1 deletion tests/Test/MapiMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testModelToFile(): void
$mapiMessage
));
$fileContent = $emlFile->fread($emlFile->getSize());
$this->assertRegExp("/" . $mapiMessage->getSubject() . "/", $fileContent);
$this->assertMatchesRegularExpression("/" . $mapiMessage->getSubject() . "/", $fileContent);

$mapiMessageConverted = $api->mapi()->message()->fromFile(new MapiMessageFromFileRequest("Eml", $emlFile));
$this->assertEquals($mapiMessage->getSubject(), $mapiMessageConverted->getSubject());
Expand Down
2 changes: 1 addition & 1 deletion tests/Test/OtherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testFile(): void
$calendarTempFile =
self::api()->cloudStorage()->file()->downloadFile(new DownloadFileRequest($storagePath, self::$storage));
$fileContent = $calendarTempFile->fread($calendarTempFile->getSize());
$this->assertRegExp("/Access-A-Ride/", $fileContent);
$this->assertMatchesRegularExpression("/Access-A-Ride/", $fileContent);
}

/**
Expand Down

0 comments on commit 8706260

Please sign in to comment.