Completed
Pull Request — master (#7)
by Louis
20:12 queued 01:16
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
7
class ClientTest extends \PHPUnit_Framework_TestCase
8
{
9
    const API_KEY = 'T6UnYqgl19';
10
11
    /**
12
     * @expectedException \EtherpadLite\Exception\UnsupportedMethodException
13
     * @dataProvider unsupportedMethodProvider
14
     */
15
    public function testUnsupportedMethods($method)
16
    {
17
        $client = new Client(self::API_KEY);
18
        $client->$method();
19
    }
20
21
    public function unsupportedMethodProvider()
22
    {
23
        return array(
24
            array('listMyImportantPad'),
25
            array('getPad'),
26
            array('setPadName')
27
        );
28
    }
29
30
    public function testGeneratePadID()
31
    {
32
        $client = new Client(self::API_KEY);
33
        $padId = $client->generatePadID();
34
35
        $this->assertTrue(is_string($padId));
36
        $this->assertEquals(16,strlen($padId));
37
    }
38
}
39