Completed
Push — master ( 185b88...fe8b2f )
by Marco
24s
created

benchInstantiateSerializableArrayObjectAsset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19
20
namespace DoctrineTest\InstantiatorPerformance;
21
22
use Doctrine\Instantiator\Instantiator;
23
use PhpBench\Benchmark\Metadata\Annotations\BeforeMethods;
24
use PhpBench\Benchmark\Metadata\Annotations\Revs;
25
26
/**
27
 * Performance tests for {@see \Doctrine\Instantiator\Instantiator}
28
 *
29
 * @author Marco Pivetta <[email protected]>
30
 *
31
 * @BeforeMethods({"init"})
32
 */
33
class InstantiatorPerformanceEvent
34
{
35
    /**
36
     * @var \Doctrine\Instantiator\Instantiator
37
     */
38
    private $instantiator;
39
40
    public function init() : void
41
    {
42
        $this->instantiator = new Instantiator();
43
44
        $this->instantiator->instantiate(__CLASS__);
45
        $this->instantiator->instantiate('ArrayObject');
46
        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset');
47
        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset');
48
        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset');
49
    }
50
51
    /**
52
     * @Revs(20000)
53
     */
54
    public function benchInstantiateSelf() : void
55
    {
56
        $this->instantiator->instantiate(__CLASS__);
57
    }
58
59
    /**
60
     * @Revs(20000)
61
     */
62
    public function benchInstantiateInternalClass() : void
63
    {
64
        $this->instantiator->instantiate('ArrayObject');
65
    }
66
67
    /**
68
     * @Revs(20000)
69
     */
70
    public function benchInstantiateSimpleSerializableAssetClass() : void
71
    {
72
        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset');
73
    }
74
75
    /**
76
     * @Revs(20000)
77
     */
78
    public function benchInstantiateSerializableArrayObjectAsset() : void
79
    {
80
        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset');
81
    }
82
83
    /**
84
     * @Revs(20000)
85
     */
86
    public function benchInstantiateUnCloneableAsset() : void
87
    {
88
        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset');
89
    }
90
}
91