Passed
Push — master ( 48b31c...af15c0 )
by Louis
02:02
created

ClientTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testUnsupportedMethods() 0 5 1
A unsupportedMethodProvider() 0 8 1
A testGeneratePadID() 0 8 1
1
<?php
2
3
namespace EtherpadLite\Tests;
4
5
use EtherpadLite\Client;
6
use PHPUnit\Framework\TestCase;
7
8
class ClientTest extends TestCase
9
{
10
    const API_KEY = 'T6UnYqgl19';
11
12
    /**
13
     * @expectedException \EtherpadLite\Exception\UnsupportedMethodException
14
     * @dataProvider unsupportedMethodProvider
15
     */
16
    public function testUnsupportedMethods($method)
17
    {
18
        $client = new Client(self::API_KEY);
19
        $client->$method();
20
    }
21
22
    public function unsupportedMethodProvider()
23
    {
24
        return array(
25
            array('listMyImportantPad'),
26
            array('getPad'),
27
            array('setPadName')
28
        );
29
    }
30
31
    public function testGeneratePadID()
32
    {
33
        $client = new Client(self::API_KEY);
34
        $padId = $client->generatePadID();
35
36
        $this->assertTrue(is_string($padId));
37
        $this->assertEquals(16,strlen($padId));
38
    }
39
}
40