Skip to content

Commit

Permalink
Made width and height required
Browse files Browse the repository at this point in the history
  • Loading branch information
j.bebendorf committed Aug 1, 2022
1 parent 738f9d6 commit 5f7904c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/LtiDeepLinkResourceIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ class LtiDeepLinkResourceIcon
private $width;
private $height;

public function __construct(string $url, ?int $width = null, ?int $height = null)
public function __construct(string $url, int $width, int $height)
{
$this->url = $url;
$this->width = $width;
$this->height = $height;
}

public static function new(string $url, ?int $width = null, ?int $height = null): LtiDeepLinkResourceIcon
public static function new(string $url, int $width, int $height): LtiDeepLinkResourceIcon
{
return new LtiDeepLinkResourceIcon($url, $width, $height);
}
Expand All @@ -32,26 +32,26 @@ public function getUrl(): string
return $this->url;
}

public function setWidth(?int $width): LtiDeepLinkResourceIcon
public function setWidth(int $width): LtiDeepLinkResourceIcon
{
$this->width = $width;

return $this;
}

public function getWidth(): ?int
public function getWidth(): int
{
return $this->width;
}

public function setHeight(?int $height): LtiDeepLinkResourceIcon
public function setHeight(int $height): LtiDeepLinkResourceIcon
{
$this->height = $height;

return $this;
}

public function getHeight(): ?int
public function getHeight(): int
{
return $this->height;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/LtiDeepLinkResourceIconTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class LtiDeepLinkResourceIconTest extends TestCase
public function setUp(): void
{
$this->imageUrl = 'https://example.com/image.png';
$this->deepLinkResourceIcon = new LtiDeepLinkResourceIcon($this->imageUrl);
$this->deepLinkResourceIcon = new LtiDeepLinkResourceIcon($this->imageUrl, 1, 2);
}

public function testItInstantiates()
Expand All @@ -19,7 +19,7 @@ public function testItInstantiates()

public function testItCreatesANewInstance()
{
$deepLinkResource = LtiDeepLinkResourceIcon::new($this->imageUrl);
$deepLinkResource = LtiDeepLinkResourceIcon::new($this->imageUrl, 100, 200);

$this->assertInstanceOf(LtiDeepLinkResourceIcon::class, $deepLinkResource);
}
Expand All @@ -44,7 +44,7 @@ public function testItGetsWidth()
{
$result = $this->deepLinkResourceIcon->getWidth();

$this->assertNull($result);
$this->assertEquals(1, $result);
}

public function testItSetsWidth()
Expand All @@ -60,7 +60,7 @@ public function testItGetsHeight()
{
$result = $this->deepLinkResourceIcon->getHeight();

$this->assertNull($result);
$this->assertEquals(2, $result);
}

public function testItSetsHeight()
Expand Down

0 comments on commit 5f7904c

Please sign in to comment.