for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Dynamic\Elements\Blog\Elements\Tests;
use Dynamic\Elements\Blog\Elements\ElementBlogPosts;
use SilverStripe\Blog\Model\Blog;
use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\FieldList;
class ElementBlogPostsTest extends SapphireTest
{
/**
* @var string
*/
protected static $fixture_file = '../fixtures.yml';
*
public function testGetSummary()
$object = $this->objFromFixture(ElementBlogPosts::class, 'one');
$this->assertEquals($object->getSummary(), $object->dbObject("Content")->Summary(20));
}
public function testGetType()
$this->assertEquals($object->getType(), 'Blog Posts');
public function testGetCMSFields()
$fields = $object->getCMSFields();
$this->assertInstanceOf(FieldList::class, $fields);
$this->assertNotNull($fields->dataFieldByName('BlogID'));
public function testGetPostsList()
$this->assertEquals($object->Blog()->getBlogPosts()->limit($object->Limit), $object->getPostsList());