-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from FRoepstorf/add-Ics-support
Add ics support
- Loading branch information
Showing
8 changed files
with
96 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/build | ||
/vendor | ||
/phpunit.xml | ||
/.idea |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 Kartenmacherei\RestFramework\Response\Content; | ||
|
||
|
||
class IcsContent implements Content | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $value; | ||
|
||
/** | ||
* @param string $value | ||
*/ | ||
public function __construct(string $value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function asString(): string | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* @return ContentType | ||
*/ | ||
public function getContentType(): ContentType | ||
{ | ||
return new IcsContentType(); | ||
} | ||
} |
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,14 @@ | ||
<?php | ||
namespace Kartenmacherei\RestFramework\Response\Content; | ||
|
||
|
||
class IcsContentType extends ContentType | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function asString(): string | ||
{ | ||
return self::ICS; | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
namespace Kartenmacherei\RestFramework\Response\Content; | ||
|
||
|
||
use PHPUnit_Framework_TestCase; | ||
/** | ||
* @covers \Kartenmacherei\RestFramework\Response\Content\IcsContent | ||
*/ | ||
class IcsContentTest extends PHPUnit_Framework_TestCase | ||
{ | ||
public function testGetContentType() | ||
{ | ||
$this->assertInstanceOf(IcsContentType::class, (new IcsContent(''))->getContentType()); | ||
} | ||
|
||
public function testAsString() | ||
{ | ||
$content = new IcsContent('Test'); | ||
$this->assertSame('Test', $content->asString()); | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
namespace Kartenmacherei\RestFramework\Response\Content; | ||
|
||
use PHPUnit_Framework_TestCase; | ||
|
||
/** | ||
* @covers \Kartenmacherei\RestFramework\Response\Content\IcsContentType | ||
*/ | ||
class IcsContentTypeTest extends PHPUnit_Framework_TestCase | ||
{ | ||
public function testAsString() | ||
{ | ||
$this->assertSame('text/calendar; charset=utf-8', (new IcsContentType())->asString()); | ||
} | ||
} |