InstagramPostTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateInstagramPost() 0 7 1
A testGetCMSFields() 0 11 1
1
<?php
2
3
namespace X3dgoo\InstagramScraper\Tests;
4
5
use SilverStripe\Dev\SapphireTest;
6
use X3dgoo\InstagramScraper\Model\InstagramPost;
7
8
class InstagramPostTest extends SapphireTest
9
{
10
    protected $usesDatabase = true;
11
12
    public function testCreateInstagramPost()
13
    {
14
        $instagramPost = InstagramPost::create();
15
        $instagramPost->write();
16
17
        $this->assertNotNull($instagramPost);
18
    }
19
20
    public function testGetCMSFields()
21
    {
22
        $instagramPost = InstagramPost::create();
23
        $instagramPost->ImageThumbnailURL = 'https://via.placeholder.com/300/000/000.png';
24
        $instagramPost->write();
25
26
        $fields = $instagramPost->getCMSFields();
27
28
        $this->assertNotNull($fields);
29
        $this->assertNotNull($fields->fieldByName('Root')->fieldByName('Main')->fieldByName('Show'));
30
    }
31
}
32