File: ServiceTest.php

package info (click to toggle)
owncloud 7.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 104,192 kB
  • sloc: php: 403,584; xml: 5,843; perl: 630; cs: 504; sh: 453; sql: 271; python: 221; makefile: 104
file content (81 lines) | stat: -rw-r--r-- 2,077 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php


namespace OpenCloud\Tests\DNS;

use OpenCloud\Compute;

class ServiceTest extends DnsTestCase
{

    public function test__construct()
    {
        $this->assertInstanceOf('OpenCloud\DNS\Service', $this->service);
    }

    public function testUrl()
    {
        $this->assertEquals(
            'https://dns.api.rackspacecloud.com/v1.0/123456',
            (string) $this->service->getUrl()
        );
    }

    public function testDomain()
    {
        $this->assertInstanceOf('OpenCloud\DNS\Resource\Domain', $this->service->domain());
    }

    /**
     * @mockFile Domain_List
     */
    public function testDomainList()
    {
        $list = $this->service->domainList();
        $this->assertInstanceOf(self::COLLECTION_CLASS, $list);
        $this->assertGreaterThan(2, strlen($list->first()->Name()));
    }

    /**
     * @expectedException Guzzle\Http\Exception\ClientErrorResponseException
     */
    public function testAsyncRequest()
    {
        $this->addMockSubscriber($this->makeResponse(null, 404));
        $this->service->AsyncRequest('FOOBAR');
    }

    public function testImport()
    {
        $this->assertInstanceOf(
            'OpenCloud\DNS\Resource\AsyncResponse', 
            $this->service->Import('foo bar oops')
        );
    }

    public function testPtrRecordList()
    {
        $server = new Compute\Resource\Server(
            $this->getClient()->computeService('cloudServersOpenStack', 'DFW', 'publicURL')
        );
        $server->id = '42';
        $this->assertInstanceOf(
            self::COLLECTION_CLASS,
            $this->service->PtrRecordList($server)
        );
    }

    public function testRecord()
    {
        $this->assertInstanceOf('OpenCloud\DNS\Resource\PtrRecord', $this->service->PtrRecord());
    }

    public function testLimitTypes()
    {
        $this->addMockSubscriber($this->makeResponse('{"limitTypes": [ "RATE_LIMIT", "DOMAIN_LIMIT", "DOMAIN_RECORD_LIMIT" ]}'));
        $arr = $this->service->LimitTypes();

        $this->assertTrue(in_array('RATE_LIMIT', $arr));
    }

}