Skip to content

Commit

Permalink
Merge pull request #5 from estevebadia/deeplink-text
Browse files Browse the repository at this point in the history
Add 'text' parameter to Deep Link resources
  • Loading branch information
dbhynds authored May 20, 2021
2 parents 5cd443f + 82159e7 commit 256dd65
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/LtiDeepLinkResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class LtiDeepLinkResource

private $type = 'ltiResourceLink';
private $title;
private $text;
private $url;
private $lineitem;
private $custom_params = [];
Expand Down Expand Up @@ -37,6 +38,17 @@ public function setTitle($value)
return $this;
}

public function getText()
{
return $this->text;
}

public function setText($value)
{
$this->text = $value;
return $this;
}

public function getUrl()
{
return $this->url;
Expand Down Expand Up @@ -86,6 +98,7 @@ public function toArray()
$resource = [
"type" => $this->type,
"title" => $this->title,
"text" => $this->text,
"url" => $this->url,
"presentation" => [
"documentTarget" => $this->target,
Expand Down
18 changes: 18 additions & 0 deletions tests/LtiDeepLinkResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ public function testItSetsTitle()
$this->assertEquals($expected, $this->deepLinkResource->getTitle());
}

public function testItGetsText()
{
$result = $this->deepLinkResource->getText();

$this->assertNull($result);
}

public function testItSetsText()
{
$expected = 'expected';

$this->deepLinkResource->setText($expected);

$this->assertEquals($expected, $this->deepLinkResource->getText());
}

public function testItGetsUrl()
{
$result = $this->deepLinkResource->getUrl();
Expand Down Expand Up @@ -126,6 +142,7 @@ public function testItCastsToArray()
$expected = [
"type" => 'ltiResourceLink',
"title" => 'a_title',
"text" => 'a_text',
"url" => 'a_url',
"presentation" => [
"documentTarget" => 'iframe',
Expand All @@ -143,6 +160,7 @@ public function testItCastsToArray()
->once()->andReturn($expected['lineItem']['label']);

$this->deepLinkResource->setTitle($expected['title']);
$this->deepLinkResource->setText($expected['text']);
$this->deepLinkResource->setUrl($expected['url']);
$this->deepLinkResource->setLineitem($lineitem);

Expand Down

0 comments on commit 256dd65

Please sign in to comment.