Skip to content

Commit 150b4e6

Browse files
committed
Improving code coverage
1 parent cc4ec20 commit 150b4e6

4 files changed

Lines changed: 32 additions & 9 deletions

File tree

src/Domain/Feature/Feature.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ abstract class Feature extends KmlObject {
2222
protected $atomAuthor;
2323
protected $atomLink;
2424
protected $address;
25-
protected $addressDetails;
2625
protected $phoneNumber;
2726
protected $snippet;
2827
protected $description;
@@ -89,14 +88,6 @@ public function setAtomLink(?Link $atomLink): void {
8988
$this->atomLink = $atomLink;
9089
}
9190

92-
public function getAddressDetails() {
93-
return $this->addressDetails;
94-
}
95-
96-
public function setAddressDetails($addressDetails) {
97-
$this->addressDetails = $addressDetails;
98-
}
99-
10091
public function getPhoneNumber(): ?string {
10192
return $this->phoneNumber;
10293
}

src/Domain/TimePrimitive/TimeStamp.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ class TimeStamp extends TimePrimitive {
1111

1212
private $when;
1313

14+
public static function fromInteger(int $unixTimestamp) {
15+
$timeStamp = new TimeStamp();
16+
$timeStamp->when = date(DATE_ISO8601, $unixTimestamp);
17+
return $timeStamp;
18+
}
19+
1420
public function accept(KmlObjectVisitorInterface $visitor): void {
1521
$visitor->visitTimeStamp($this);
1622
}

tests/src/Domain/AbstractView/CameraTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
namespace LibKml\Tests\Domain\AbstractView;
44

55
use LibKml\Domain\AbstractView\Camera;
6+
use LibKml\Domain\FieldType\AltitudeMode;
67
use LibKml\Domain\KmlObjectVisitorInterface;
8+
use LibKml\Domain\TimePrimitive\TimeStamp;
79
use PHPUnit\Framework\TestCase;
810

911
class CameraTest extends TestCase {
@@ -39,4 +41,20 @@ public function testRollField() {
3941
$this->assertEquals($roll, $this->camera->getRoll());
4042
}
4143

44+
public function testAltitudeModeField() {
45+
$altitudeMode = AltitudeMode::ABSOLUTE;
46+
47+
$this->camera->setAltitudeMode($altitudeMode);
48+
49+
$this->assertEquals($altitudeMode, $this->camera->getAltitudeMode());
50+
}
51+
52+
public function testTimePrimitive() {
53+
$timeStamp = TimeStamp::fromInteger(time());
54+
55+
$this->camera->setTimePrimitive($timeStamp);
56+
57+
$this->assertEquals($timeStamp, $this->camera->getTimePrimitive());
58+
}
59+
4260
}

tests/src/Domain/TimePrimitive/TimeStampTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,13 @@ public function testWhenField() {
3737

3838
$this->assertEquals($when, $this->timeStamp->getWhen());
3939
}
40+
41+
public function testFromInteger() {
42+
$unixTimestamp = time();
43+
44+
$timeStamp = TimeStamp::fromInteger($unixTimestamp);
45+
46+
$this->assertEquals(date(DATE_ISO8601, $unixTimestamp), $timeStamp->getWhen());
47+
}
4048

4149
}

0 commit comments

Comments
 (0)