VultrTest::testApplication()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/*
3
 *   This file is part of the Vultr PHP library.
4
 *
5
 *   (c) Albert Leitato <[email protected]>
6
 *
7
 *   For the full copyright and license information, please view the LICENSE
8
 *   file that was distributed with this source code.
9
 */
10
namespace Vultr\Tests;
11
12
class VultrTest extends TestCase
13
{
14
    /**
15
     * @covers \Vultr\Vultr::__get
16
     * @covers \Vultr\Vultr::getClass
17
     * @covers \Vultr\Vultr::__construct
18
     * @covers \Vultr\Support\Str::studly
19
     * @covers \Vultr\Api\AbstractApi::__construct
20
     */
21
    public function testAccount()
22
    {
23
        $account = $this->vultr->account;
0 ignored issues
show
Bug introduced by
The property account does not seem to exist in Vultr\Vultr.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
24
        $this->assertInstanceOf('Vultr\Api\Account', $account);
25
    }
26
    /**
27
     * @covers \Vultr\Vultr::__get
28
     * @covers \Vultr\Vultr::getClass
29
     * @covers \Vultr\Vultr::__construct
30
     * @covers \Vultr\Support\Str::studly
31
     * @covers \Vultr\Api\AbstractApi::__construct
32
     */
33
    public function testApplication()
34
    {
35
        $application = $this->vultr->application;
0 ignored issues
show
Bug introduced by
The property application does not seem to exist in Vultr\Vultr.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
36
        $this->assertInstanceOf('Vultr\Api\Application', $application);
37
    }
38
    /**
39
     * @covers \Vultr\Vultr::__get
40
     * @covers \Vultr\Vultr::getClass
41
     * @covers \Vultr\Vultr::__construct
42
     * @covers \Vultr\Support\Str::studly
43
     * @covers \Vultr\Api\AbstractApi::__construct
44
     */
45
    public function testAuth()
46
    {
47
        $this->assertInstanceOf('Vultr\Api\Auth', $this->vultr->auth);
0 ignored issues
show
Documentation introduced by
The property auth does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
48
    }
49
    /**
50
     * @covers \Vultr\Vultr::__get
51
     * @covers \Vultr\Vultr::getClass
52
     * @covers \Vultr\Vultr::__construct
53
     * @covers \Vultr\Support\Str::studly
54
     * @covers \Vultr\Api\AbstractApi::__construct
55
     */
56
    public function testBackup()
57
    {
58
        $this->assertInstanceOf('Vultr\Api\Backup', $this->vultr->backup);
0 ignored issues
show
Documentation introduced by
The property backup does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
59
    }
60
    /**
61
     * @covers \Vultr\Vultr::__get
62
     * @covers \Vultr\Vultr::getClass
63
     * @covers \Vultr\Vultr::__construct
64
     * @covers \Vultr\Support\Str::studly
65
     * @covers \Vultr\Api\AbstractApi::__construct
66
     */
67
    public function testDomain()
68
    {
69
        $this->assertInstanceOf('Vultr\Api\Domain', $this->vultr->domain);
0 ignored issues
show
Documentation introduced by
The property domain does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
70
    }
71
    /**
72
     * @covers \Vultr\Vultr::__get
73
     * @covers \Vultr\Vultr::getClass
74
     * @covers \Vultr\Vultr::__construct
75
     * @covers \Vultr\Support\Str::studly
76
     * @covers \Vultr\Api\AbstractApi::__construct
77
     */
78
    public function testBlock()
79
    {
80
        $this->assertInstanceOf('Vultr\Api\Block', $this->vultr->block);
0 ignored issues
show
Documentation introduced by
The property block does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
81
    }
82
83
    /**
84
     * @covers \Vultr\Vultr::__get
85
     * @covers \Vultr\Vultr::getClass
86
     * @covers \Vultr\Vultr::__construct
87
     * @covers \Vultr\Support\Str::studly
88
     * @covers \Vultr\Api\AbstractApi::__construct
89
     */
90
    public function testDomainRecord()
91
    {
92
        $this->assertInstanceOf('Vultr\Api\DomainRecord', $this->vultr->domain_record);
0 ignored issues
show
Documentation introduced by
The property domain_record does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
93
    }
94
95
    /**
96
     * @covers \Vultr\Vultr::__get
97
     * @covers \Vultr\Vultr::getClass
98
     * @covers \Vultr\Vultr::__construct
99
     * @covers \Vultr\Support\Str::studly
100
     * @covers \Vultr\Api\AbstractApi::__construct
101
     */
102
    public function testFirewallGroup()
103
    {
104
        $this->assertInstanceOf('Vultr\Api\FirewallGroup', $this->vultr->firewall_group);
0 ignored issues
show
Documentation introduced by
The property firewall_group does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
105
    }
106
107
    /**
108
     * @covers \Vultr\Vultr::__get
109
     * @covers \Vultr\Vultr::getClass
110
     * @covers \Vultr\Vultr::__construct
111
     * @covers \Vultr\Support\Str::studly
112
     * @covers \Vultr\Api\AbstractApi::__construct
113
     */
114
    public function testFirewallRule()
115
    {
116
        $this->assertInstanceOf('Vultr\Api\FirewallRule', $this->vultr->firewall_rule);
0 ignored issues
show
Documentation introduced by
The property firewall_rule does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
117
    }
118
119
    /**
120
     * @covers \Vultr\Vultr::__get
121
     * @covers \Vultr\Vultr::getClass
122
     * @covers \Vultr\Vultr::__construct
123
     * @covers \Vultr\Support\Str::studly
124
     * @covers \Vultr\Api\AbstractApi::__construct
125
     */
126
    public function testImage()
127
    {
128
        $this->assertInstanceOf('Vultr\Api\Image', $this->vultr->image);
0 ignored issues
show
Documentation introduced by
The property image does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
129
    }
130
131
    /**
132
     * @covers \Vultr\Vultr::__get
133
     * @covers \Vultr\Vultr::getClass
134
     * @covers \Vultr\Vultr::__construct
135
     * @covers \Vultr\Support\Str::studly
136
     * @covers \Vultr\Api\AbstractApi::__construct
137
     */
138
    public function testOs()
139
    {
140
        $this->assertInstanceOf('Vultr\Api\Os', $this->vultr->os);
0 ignored issues
show
Documentation introduced by
The property os does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
141
    }
142
143
    /**
144
     * @covers \Vultr\Vultr::__get
145
     * @covers \Vultr\Vultr::getClass
146
     * @covers \Vultr\Vultr::__construct
147
     * @covers \Vultr\Support\Str::studly
148
     * @covers \Vultr\Api\AbstractApi::__construct
149
     */
150
    public function testPlan()
151
    {
152
        $this->assertInstanceOf('Vultr\Api\Plan', $this->vultr->plan);
0 ignored issues
show
Documentation introduced by
The property plan does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
153
    }
154
155
    /**
156
     * @covers \Vultr\Vultr::__get
157
     * @covers \Vultr\Vultr::getClass
158
     * @covers \Vultr\Vultr::__construct
159
     * @covers \Vultr\Support\Str::studly
160
     * @covers \Vultr\Api\AbstractApi::__construct
161
     */
162
    public function testRegion()
163
    {
164
        $this->assertInstanceOf('Vultr\Api\Region', $this->vultr->region);
0 ignored issues
show
Documentation introduced by
The property region does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
165
    }
166
167
    /**
168
     * @covers \Vultr\Vultr::__get
169
     * @covers \Vultr\Vultr::getClass
170
     * @covers \Vultr\Vultr::__construct
171
     * @covers \Vultr\Support\Str::studly
172
     * @covers \Vultr\Api\AbstractApi::__construct
173
     */
174
    public function testReservedIp()
175
    {
176
        $this->assertInstanceOf('Vultr\Api\ReservedIp', $this->vultr->reserved_ip);
0 ignored issues
show
Documentation introduced by
The property reserved_ip does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
177
    }
178
179
    /**
180
     * @covers \Vultr\Vultr::__get
181
     * @covers \Vultr\Vultr::getClass
182
     * @covers \Vultr\Vultr::__construct
183
     * @covers \Vultr\Support\Str::studly
184
     * @covers \Vultr\Api\AbstractApi::__construct
185
     */
186
    public function testServer()
187
    {
188
        $this->assertInstanceOf('Vultr\Api\Server', $this->vultr->server);
0 ignored issues
show
Documentation introduced by
The property server does not exist on object<Vultr\Vultr>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
189
    }
190
}
191