mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
MINOR: add unit test for receiving trackback
This commit is contained in:
parent
8b4b0f9ac6
commit
dc879cb49f
@ -1,4 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* @package blog
|
||||
* @subpackage tests
|
||||
*/
|
||||
class BlogEntryTest extends SapphireTest {
|
||||
static $fixture_file = 'blog/tests/BlogTest.yml';
|
||||
|
||||
@ -23,4 +27,31 @@ class BlogEntryTest extends SapphireTest {
|
||||
$this->assertEquals('<a href="admin">the CMS</a>', $entry->Content());
|
||||
BlogEntry::$allow_wysiwyg_editing = $tmpFlag;
|
||||
}
|
||||
|
||||
function testTrackback() {
|
||||
$blog = $this->objFromFixture('BlogHolder', 'mainblog');
|
||||
$blog->TrackBacksEnabled = true;
|
||||
$blog->write();
|
||||
|
||||
$entry = $this->objFromFixture('BlogEntry', 'testpost');
|
||||
$response = $entry->trackbackping();
|
||||
|
||||
$this->assertContains("<error>1</error>", $response);
|
||||
|
||||
$_POST['url'] = 'test trackback post url';
|
||||
$_POST['title'] = 'test trackback post title';
|
||||
$_POST['excerpt'] = 'test trackback post excerpt';
|
||||
$_POST['blog_name'] = 'test trackback blog name';
|
||||
|
||||
$response = $entry->trackbackping();
|
||||
$this->assertContains("<error>0</error>", $response);
|
||||
|
||||
$trackback = DataObject::get_one('TrackBackPing');
|
||||
$this->assertEquals('test trackback post url', $trackback->Url);
|
||||
$this->assertEquals('test trackback post title', $trackback->Title);
|
||||
$this->assertEquals('test trackback post excerpt', $trackback->Excerpt);
|
||||
$this->assertEquals('test trackback blog name', $trackback->BlogName);
|
||||
|
||||
unset($_POST);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user