Passed
Push — main ( 18364d...44ad79 )
by Osvaldo
01:51
created

testSiLaClaseExisteYDevuelveUnObjeto()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
namespace test;
4
5
use \PHPUnit\Framework\TestCase;
6
use Exception;
7
use src\Factory;
8
use test\CrearDummy;
9
10
class FactoryTest extends TestCase
11
{
12
    public function setUp(): void
13
    {
14
        $this->class = new Factory();
0 ignored issues
show
Bug Best Practice introduced by
The property class does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
15
        $this->crearDummy = new CrearDummy;
0 ignored issues
show
Bug Best Practice introduced by
The property crearDummy does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
16
    }
17
18
    public function testSiLaClaseNoExisteSeEsperaUnaExcepcion()
19
    {
20
        $this->expectException(Exception::class);
21
        $this->class->crear('Hola', array('hola'));
22
    }
23
24
    public function testSiLaClaseExisteYDevuelveUnObjeto()
25
    {
26
        $this->assertIsObject($this->class->crear('test\Dummy', array() ) );
27
    }
28
29
    public function testSiRegresaUnaClaseEsConsideradaUnObjeto()
30
    {
31
        $this->assertIsObject( $this->crearDummy->crear(array() ) );
32
    }
33
}