for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Dynamic\ShortURL\Test;
use Dynamic\ShortUR\Model\ShortURL;
use SilverStripe\Dev\SapphireTest;
class ShortURLTest extends SapphireTest
{
/**
* @var array
*/
protected static $fixture_file = [
'../fixtures.yml',
];
*
public function testGetCMSFields()
$object = $this->objFromFixture(ShortURL::class, 'one');
$fields = $object->getCMSFields();
$this->assertInstanceOf('FieldList', $fields);
}
public function testGetValidate()
$object->Title = '';
$this->expectException('ValidationException');
$object->write();
$this->objFromFixture(ShortURL::class, 'one');
$object->URL = '';
$object->CampaignSource = '';
function testGetLongURL()
$expected = $object->URL . '?utm_source=' . $object->CampaignSource;
$this->assertEquals($expected, $object->getLongURL());