Completed
Push — master ( af4b60...a13948 )
by Jefersson
11s
created

GetMethodIfExistsTest::testGetExistingMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license.
17
 */
18
19
declare(strict_types=1);
20
21
namespace ProxyManagerTest\ProxyGenerator\Util;
22
23
use PHPUnit_Framework_TestCase;
24
use ProxyManager\ProxyGenerator\Util\GetMethodIfExists;
25
26
/**
27
 * Tests for {@see \ProxyManager\ProxyGenerator\Util\GetMethodIfExists}
28
 *
29
 * @author Marco Pivetta <[email protected]>
30
 * @license MIT
31
 *
32
 * @covers \ProxyManager\ProxyGenerator\Util\GetMethodIfExists
33
 * @group Coverage
34
 */
35
class GetMethodIfExistsTest extends PHPUnit_Framework_TestCase
36
{
37
    public function testGetExistingMethod() : void
38
    {
39
        $method = GetMethodIfExists::get(new \ReflectionClass(self::class), 'testGetExistingMethod');
40
41
        self::assertInstanceOf(\ReflectionMethod::class, $method);
42
        self::assertSame('testGetExistingMethod', $method->getName());
43
        self::assertSame(self::class, $method->getDeclaringClass()->getName());
44
    }
45
46
    public function testGetNonExistingMethod() : void
47
    {
48
        self::assertNull(GetMethodIfExists::get(new \ReflectionClass(self::class), uniqid('nonExisting', true)));
49
    }
50
}
51