-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
74 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
abstractions/php/tests/Microsoft/Kiota/Tests/SampleTest.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Microsoft\Kiota\Abstractions\Tests\Types; | ||
|
||
use Microsoft\Kiota\Abstractions\Types\Date; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class DateTest extends TestCase | ||
{ | ||
public function testConstructWithDateString(): void | ||
{ | ||
$dateString = "2022-01-27"; | ||
$date = new Date($dateString); | ||
$this->assertInstanceOf(Date::class, $date); | ||
$this->assertEquals($dateString, strval($date)); | ||
} | ||
|
||
public function testConstructorWithInvalidDateStringThrowsException(): void | ||
{ | ||
$this->expectException(\Exception::class); | ||
$date = new Date("invalid string"); | ||
} | ||
|
||
public function testCreateFromDateTime(): void | ||
{ | ||
$date = Date::createFromDateTime(new \DateTime("2022-01-2700:00:00")); | ||
$this->assertEquals("2022-01-27", strval($date)); | ||
} | ||
|
||
public function testCreateFrom(): void | ||
{ | ||
$date = Date::createFrom(2022, 01, 27); | ||
$this->assertEquals("2022-01-27", strval($date)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Microsoft\Kiota\Abstractions\Tests\Types; | ||
|
||
use Microsoft\Kiota\Abstractions\Types\Time; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class TimeTest extends TestCase | ||
{ | ||
public function testConstructorWithValidTimeString(): void | ||
{ | ||
$time = new Time("19:25:00"); | ||
$this->assertInstanceOf(Time::class, $time); | ||
} | ||
|
||
public function testConstructorWithInvalidTimeString(): void | ||
{ | ||
$this->expectException(\Exception::class); | ||
$time = new Time("invalid string"); | ||
} | ||
|
||
public function testCreateFromDateTime(): void | ||
{ | ||
$time = Time::createFromDateTime(new \DateTime("2022-01-2719:25:00")); | ||
$this->assertInstanceOf(Time::class, $time); | ||
$this->assertEquals("19:25:00", strval($time)); | ||
} | ||
|
||
public function testCreateFrom(): void | ||
{ | ||
$time = Time::createFrom(19, 25, 0); | ||
$this->assertInstanceOf(Time::class, $time); | ||
$this->assertEquals("19:25:00", strval($time)); | ||
} | ||
} |