Passed
Branch dev (13936a)
by Shashi Prakash
01:33
created

OpenGraphTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testFetchReturnsEmptyArrayForWebsiteWithNoMetadata() 0 8 1
A testFetch() 0 11 1
1
<?php
2
3
namespace shweshi\OpenGraph\Test;
4
5
use PHPUnit\Framework\TestCase;
6
use shweshi\OpenGraph\OpenGraph;
7
8
class OpenGraphTest extends TestCase
9
{
10
    /** @test */
11
    public function testFetch()
12
   {
13
        $o = new OpenGraph();
14
       $data = $o->fetch(
15
         'https://www.unsplash.com/'
16
       );
17
       $this->assertArrayHasKey('title', $data);
18
       $this->assertArrayHasKey('description', $data);
19
       $this->assertArrayHasKey('type', $data);
20
       $this->assertArrayHasKey('url', $data);
21
       $this->assertArrayHasKey('image', $data);
22
   }
23
24
   /** @test */
25
   public function testFetchReturnsEmptyArrayForWebsiteWithNoMetadata()
26
  {
27
       $o = new OpenGraph();
28
      $data = $o->fetch(
29
        'https://www.example.com/'
30
      );
31
32
      $this->assertEmpty($data);
33
  }
34
}
35