-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CategoryDocument, MemberUri. More tests.
- Loading branch information
Showing
17 changed files
with
440 additions
and
21 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
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,56 @@ | ||
<?php | ||
/** | ||
* Atom Publishing Protocol support | ||
* | ||
* @author Михаил Красильников <m.krasilnikov@yandex.ru> | ||
* @license MIT | ||
*/ | ||
namespace Mekras\AtomPub\Tests\Document; | ||
|
||
use Mekras\AtomPub\Document\CategoryDocument; | ||
use Mekras\AtomPub\Tests\TestCase; | ||
|
||
/** | ||
* Tests for Mekras\AtomPub\Document\CategoryDocument | ||
* | ||
* @covers Mekras\AtomPub\Document\CategoryDocument | ||
* @covers Mekras\AtomPub\Document\Document | ||
*/ | ||
class CategoryDocumentTest extends TestCase | ||
{ | ||
/** | ||
* | ||
*/ | ||
public function testParse() | ||
{ | ||
$document = new CategoryDocument($this->loadFixture('CategoryDocument.xml')); | ||
$items = $document->getCategories(); | ||
|
||
static::assertTrue($document->isFixed()); | ||
static::assertEquals('http://example.com/cats/big3', $document->getScheme()); | ||
static::assertNull($document->getHref()); | ||
static::assertCount(3, $items); | ||
static::assertEquals('vegetable', $items[1]->getTerm()); | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
public function testCreate() | ||
{ | ||
$document = new CategoryDocument(); | ||
$document->setFixed(false); | ||
$document->setScheme('http://example.com/cats/big3'); | ||
$document->setHref(null); | ||
$document->addCategory('animal'); | ||
$document->addCategory('vegetable'); | ||
$document->addCategory('mineral'); | ||
|
||
$doc = $document->getDomDocument(); | ||
$doc->formatOutput = true; | ||
static::assertEquals( | ||
file_get_contents($this->locateFixture('CategoryDocument.txt')), | ||
$doc->saveXML() | ||
); | ||
} | ||
} |
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,31 @@ | ||
<?php | ||
/** | ||
* Atom Publishing Protocol support | ||
* | ||
* @author Михаил Красильников <m.krasilnikov@yandex.ru> | ||
* @license MIT | ||
*/ | ||
namespace Mekras\AtomPub\Tests\Document; | ||
|
||
use Mekras\AtomPub\Document\EntryDocument; | ||
use Mekras\AtomPub\Element\Entry; | ||
use Mekras\AtomPub\Tests\TestCase; | ||
|
||
/** | ||
* Tests for Mekras\AtomPub\Document\EntryDocument | ||
* | ||
* @covers Mekras\AtomPub\Document\EntryDocument | ||
*/ | ||
class EntryDocumentTest extends TestCase | ||
{ | ||
/** | ||
* EntryDocument::getEntry should return AtomPub version of Entry class. | ||
*/ | ||
public function testAtomPubEntry() | ||
{ | ||
$document = new EntryDocument($this->loadFixture('EntryDocument.xml')); | ||
$feed = $document->getEntry(); | ||
|
||
static::assertInstanceOf(Entry::class, $feed); | ||
} | ||
} |
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,31 @@ | ||
<?php | ||
/** | ||
* Atom Publishing Protocol support | ||
* | ||
* @author Михаил Красильников <m.krasilnikov@yandex.ru> | ||
* @license MIT | ||
*/ | ||
namespace Mekras\AtomPub\Tests\Document; | ||
|
||
use Mekras\AtomPub\Document\FeedDocument; | ||
use Mekras\AtomPub\Element\Feed; | ||
use Mekras\AtomPub\Tests\TestCase; | ||
|
||
/** | ||
* Tests for Mekras\AtomPub\Document\FeedDocument | ||
* | ||
* @covers Mekras\AtomPub\Document\FeedDocument | ||
*/ | ||
class FeedDocumentTest extends TestCase | ||
{ | ||
/** | ||
* FeedDocument::getFeed should return AtomPub version of Feed class. | ||
*/ | ||
public function testAtomPubFeed() | ||
{ | ||
$document = new FeedDocument($this->loadFixture('FeedDocument.xml')); | ||
$feed = $document->getFeed(); | ||
|
||
static::assertInstanceOf(Feed::class, $feed); | ||
} | ||
} |
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
Oops, something went wrong.