1<?php
2class Framework_MockObject_Invocation_StaticTest extends PHPUnit_Framework_TestCase
3{
4    public function testConstructorRequiresClassAndMethodAndParameters()
5    {
6        $this->assertInstanceOf(
7            PHPUnit_Framework_MockObject_Invocation_Static::class,
8            new PHPUnit_Framework_MockObject_Invocation_Static(
9                'FooClass',
10                'FooMethod',
11                ['an_argument'],
12                'ReturnType'
13            )
14        );
15    }
16
17    public function testAllowToGetClassNameSetInConstructor()
18    {
19        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
20            'FooClass',
21            'FooMethod',
22            ['an_argument'],
23            'ReturnType'
24        );
25
26        $this->assertSame('FooClass', $invocation->className);
27    }
28
29    public function testAllowToGetMethodNameSetInConstructor()
30    {
31        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
32            'FooClass',
33            'FooMethod',
34            ['an_argument'],
35            'ReturnType'
36        );
37
38        $this->assertSame('FooMethod', $invocation->methodName);
39    }
40
41    public function testAllowToGetMethodParametersSetInConstructor()
42    {
43        $expectedParameters = [
44          'foo', 5, ['a', 'b'], new stdClass, null, false
45        ];
46
47        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
48            'FooClass',
49            'FooMethod',
50            $expectedParameters,
51            'ReturnType'
52        );
53
54        $this->assertSame($expectedParameters, $invocation->parameters);
55    }
56
57    public function testConstructorAllowToSetFlagCloneObjectsInParameters()
58    {
59        $parameters   = [new stdClass];
60        $cloneObjects = true;
61
62        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
63            'FooClass',
64            'FooMethod',
65            $parameters,
66            'ReturnType',
67            $cloneObjects
68        );
69
70        $this->assertEquals($parameters, $invocation->parameters);
71        $this->assertNotSame($parameters, $invocation->parameters);
72    }
73
74    public function testAllowToGetReturnTypeSetInConstructor()
75    {
76        $expectedReturnType = 'string';
77
78        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
79            'FooClass',
80            'FooMethod',
81            ['an_argument'],
82            $expectedReturnType
83        );
84
85        $this->assertSame($expectedReturnType, $invocation->returnType);
86    }
87}
88