Completed
Push — master ( 7b4143...7f762c )
by Jason
10s
created

tests/ShortURLTest.php (4 issues)

Labels

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Dynamic\ShortURL\Tests;
4
5
class ShortURLTest extends \SapphireTest
6
{
7
    /**
8
     * @var array
9
     */
10
    protected static $fixture_file = array(
11
        'shorturls/tests/fixtures.yml',
12
    );
13
14
    /**
15
     *
16
     */
17
    public function testGetCMSFields()
18
    {
19
        $object = $this->objFromFixture('Dynamic\\ShortURL\\ShortURL', 'one');
20
        $fields = $object->getCMSFields();
21
        $this->assertInstanceOf('FieldList', $fields);
22
    }
23
24
    /**
25
     *
26
     */
27
    public function testGetValidate()
28
    {
29
        $object = $this->objFromFixture('Dynamic\\ShortURL\\ShortURL', 'one');
30
        $object->Title = '';
31
        $this->setExpectedException('ValidationException');
0 ignored issues
show
The method setExpectedException() does not seem to exist on object<Dynamic\ShortURL\Tests\ShortURLTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
        $object->write();
33
34
        $this->objFromFixture('Dynamic\\ShortURL\\ShortURL', 'one');
35
        $object->URL = '';
36
        $this->setExpectedException('ValidationException');
0 ignored issues
show
The method setExpectedException() does not seem to exist on object<Dynamic\ShortURL\Tests\ShortURLTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
        $object->write();
38
39
        $this->objFromFixture('Dynamic\\ShortURL\\ShortURL', 'one');
40
        $object->CampaignSource = '';
41
        $this->setExpectedException('ValidationException');
0 ignored issues
show
The method setExpectedException() does not seem to exist on object<Dynamic\ShortURL\Tests\ShortURLTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
        $object->write();
43
    }
44
45
    /**
46
     *
47
     */
48
    function testGetLongURL()
49
    {
50
        $object = $this->objFromFixture('Dynamic\\ShortURL\\ShortURL', 'one');
51
        $expected = $object->URL . '?utm_source=' . $object->CampaignSource;
52
        $this->assertEquals($expected, $object->getLongURL());
0 ignored issues
show
The method assertEquals() does not seem to exist on object<Dynamic\ShortURL\Tests\ShortURLTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
53
    }
54
}