Completed
Push — master ( 52755b...6c4366 )
by smiley
02:13
created
vendor/phpunit/phpunit-mock-objects/tests/Invocation/StaticTest.php 1 patch
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -12,87 +12,87 @@
 block discarded – undo
12 12
 
13 13
 class Framework_MockObject_Invocation_StaticTest extends TestCase
14 14
 {
15
-    public function testConstructorRequiresClassAndMethodAndParameters()
16
-    {
17
-        $this->assertInstanceOf(
18
-            PHPUnit_Framework_MockObject_Invocation_Static::class,
19
-            new PHPUnit_Framework_MockObject_Invocation_Static(
20
-                'FooClass',
21
-                'FooMethod',
22
-                ['an_argument'],
23
-                'ReturnType'
24
-            )
25
-        );
26
-    }
15
+	public function testConstructorRequiresClassAndMethodAndParameters()
16
+	{
17
+		$this->assertInstanceOf(
18
+			PHPUnit_Framework_MockObject_Invocation_Static::class,
19
+			new PHPUnit_Framework_MockObject_Invocation_Static(
20
+				'FooClass',
21
+				'FooMethod',
22
+				['an_argument'],
23
+				'ReturnType'
24
+			)
25
+		);
26
+	}
27 27
 
28
-    public function testAllowToGetClassNameSetInConstructor()
29
-    {
30
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
31
-            'FooClass',
32
-            'FooMethod',
33
-            ['an_argument'],
34
-            'ReturnType'
35
-        );
28
+	public function testAllowToGetClassNameSetInConstructor()
29
+	{
30
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
31
+			'FooClass',
32
+			'FooMethod',
33
+			['an_argument'],
34
+			'ReturnType'
35
+		);
36 36
 
37
-        $this->assertSame('FooClass', $invocation->className);
38
-    }
37
+		$this->assertSame('FooClass', $invocation->className);
38
+	}
39 39
 
40
-    public function testAllowToGetMethodNameSetInConstructor()
41
-    {
42
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
43
-            'FooClass',
44
-            'FooMethod',
45
-            ['an_argument'],
46
-            'ReturnType'
47
-        );
40
+	public function testAllowToGetMethodNameSetInConstructor()
41
+	{
42
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
43
+			'FooClass',
44
+			'FooMethod',
45
+			['an_argument'],
46
+			'ReturnType'
47
+		);
48 48
 
49
-        $this->assertSame('FooMethod', $invocation->methodName);
50
-    }
49
+		$this->assertSame('FooMethod', $invocation->methodName);
50
+	}
51 51
 
52
-    public function testAllowToGetMethodParametersSetInConstructor()
53
-    {
54
-        $expectedParameters = [
55
-          'foo', 5, ['a', 'b'], new stdClass, null, false
56
-        ];
52
+	public function testAllowToGetMethodParametersSetInConstructor()
53
+	{
54
+		$expectedParameters = [
55
+		  'foo', 5, ['a', 'b'], new stdClass, null, false
56
+		];
57 57
 
58
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
59
-            'FooClass',
60
-            'FooMethod',
61
-            $expectedParameters,
62
-            'ReturnType'
63
-        );
58
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
59
+			'FooClass',
60
+			'FooMethod',
61
+			$expectedParameters,
62
+			'ReturnType'
63
+		);
64 64
 
65
-        $this->assertSame($expectedParameters, $invocation->parameters);
66
-    }
65
+		$this->assertSame($expectedParameters, $invocation->parameters);
66
+	}
67 67
 
68
-    public function testConstructorAllowToSetFlagCloneObjectsInParameters()
69
-    {
70
-        $parameters   = [new stdClass];
71
-        $cloneObjects = true;
68
+	public function testConstructorAllowToSetFlagCloneObjectsInParameters()
69
+	{
70
+		$parameters   = [new stdClass];
71
+		$cloneObjects = true;
72 72
 
73
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
74
-            'FooClass',
75
-            'FooMethod',
76
-            $parameters,
77
-            'ReturnType',
78
-            $cloneObjects
79
-        );
73
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
74
+			'FooClass',
75
+			'FooMethod',
76
+			$parameters,
77
+			'ReturnType',
78
+			$cloneObjects
79
+		);
80 80
 
81
-        $this->assertEquals($parameters, $invocation->parameters);
82
-        $this->assertNotSame($parameters, $invocation->parameters);
83
-    }
81
+		$this->assertEquals($parameters, $invocation->parameters);
82
+		$this->assertNotSame($parameters, $invocation->parameters);
83
+	}
84 84
 
85
-    public function testAllowToGetReturnTypeSetInConstructor()
86
-    {
87
-        $expectedReturnType = 'string';
85
+	public function testAllowToGetReturnTypeSetInConstructor()
86
+	{
87
+		$expectedReturnType = 'string';
88 88
 
89
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
90
-            'FooClass',
91
-            'FooMethod',
92
-            ['an_argument'],
93
-            $expectedReturnType
94
-        );
89
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Static(
90
+			'FooClass',
91
+			'FooMethod',
92
+			['an_argument'],
93
+			$expectedReturnType
94
+		);
95 95
 
96
-        $this->assertSame($expectedReturnType, $invocation->returnType);
97
-    }
96
+		$this->assertSame($expectedReturnType, $invocation->returnType);
97
+	}
98 98
 }
Please login to merge, or discard this patch.
phpunit/phpunit-mock-objects/tests/Matcher/ConsecutiveParametersTest.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -13,56 +13,56 @@
 block discarded – undo
13 13
 
14 14
 class Framework_MockObject_Matcher_ConsecutiveParametersTest extends TestCase
15 15
 {
16
-    public function testIntegration()
17
-    {
18
-        $mock = $this->getMockBuilder(stdClass::class)
19
-                     ->setMethods(['foo'])
20
-                     ->getMock();
16
+	public function testIntegration()
17
+	{
18
+		$mock = $this->getMockBuilder(stdClass::class)
19
+					 ->setMethods(['foo'])
20
+					 ->getMock();
21 21
 
22
-        $mock->expects($this->any())
23
-             ->method('foo')
24
-             ->withConsecutive(
25
-                 ['bar'],
26
-                 [21, 42]
27
-             );
22
+		$mock->expects($this->any())
23
+			 ->method('foo')
24
+			 ->withConsecutive(
25
+				 ['bar'],
26
+				 [21, 42]
27
+			 );
28 28
 
29
-        $this->assertNull($mock->foo('bar'));
30
-        $this->assertNull($mock->foo(21, 42));
31
-    }
29
+		$this->assertNull($mock->foo('bar'));
30
+		$this->assertNull($mock->foo(21, 42));
31
+	}
32 32
 
33
-    public function testIntegrationWithLessAssertionsThanMethodCalls()
34
-    {
35
-        $mock = $this->getMockBuilder(stdClass::class)
36
-                     ->setMethods(['foo'])
37
-                     ->getMock();
33
+	public function testIntegrationWithLessAssertionsThanMethodCalls()
34
+	{
35
+		$mock = $this->getMockBuilder(stdClass::class)
36
+					 ->setMethods(['foo'])
37
+					 ->getMock();
38 38
 
39
-        $mock->expects($this->any())
40
-             ->method('foo')
41
-             ->withConsecutive(
42
-                 ['bar']
43
-             );
39
+		$mock->expects($this->any())
40
+			 ->method('foo')
41
+			 ->withConsecutive(
42
+				 ['bar']
43
+			 );
44 44
 
45
-        $this->assertNull($mock->foo('bar'));
46
-        $this->assertNull($mock->foo(21, 42));
47
-    }
45
+		$this->assertNull($mock->foo('bar'));
46
+		$this->assertNull($mock->foo(21, 42));
47
+	}
48 48
 
49
-    public function testIntegrationExpectingException()
50
-    {
51
-        $mock = $this->getMockBuilder(stdClass::class)
52
-                     ->setMethods(['foo'])
53
-                     ->getMock();
49
+	public function testIntegrationExpectingException()
50
+	{
51
+		$mock = $this->getMockBuilder(stdClass::class)
52
+					 ->setMethods(['foo'])
53
+					 ->getMock();
54 54
 
55
-        $mock->expects($this->any())
56
-             ->method('foo')
57
-             ->withConsecutive(
58
-                 ['bar'],
59
-                 [21, 42]
60
-             );
55
+		$mock->expects($this->any())
56
+			 ->method('foo')
57
+			 ->withConsecutive(
58
+				 ['bar'],
59
+				 [21, 42]
60
+			 );
61 61
 
62
-        $mock->foo('bar');
62
+		$mock->foo('bar');
63 63
 
64
-        $this->expectException(ExpectationFailedException::class);
64
+		$this->expectException(ExpectationFailedException::class);
65 65
 
66
-        $mock->foo('invalid');
67
-    }
66
+		$mock->foo('invalid');
67
+	}
68 68
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit-mock-objects/tests/GeneratorTest.php 2 patches
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -25,187 +25,187 @@
 block discarded – undo
25 25
  */
26 26
 class Framework_MockObject_GeneratorTest extends TestCase
27 27
 {
28
-    /**
29
-     * @var PHPUnit_Framework_MockObject_Generator
30
-     */
31
-    private $generator;
32
-
33
-    protected function setUp()
34
-    {
35
-        $this->generator = new PHPUnit_Framework_MockObject_Generator;
36
-    }
37
-
38
-    /**
39
-     * @expectedException PHPUnit_Framework_MockObject_RuntimeException
40
-     */
41
-    public function testGetMockFailsWhenInvalidFunctionNameIsPassedInAsAFunctionToMock()
42
-    {
43
-        $this->generator->getMock(stdClass::class, [0]);
44
-    }
45
-
46
-    public function testGetMockCanCreateNonExistingFunctions()
47
-    {
48
-        $mock = $this->generator->getMock(stdClass::class, ['testFunction']);
49
-
50
-        $this->assertTrue(method_exists($mock, 'testFunction'));
51
-    }
52
-
53
-    /**
54
-     * @expectedException PHPUnit_Framework_MockObject_RuntimeException
55
-     * @expectedExceptionMessage duplicates: "foo, bar, foo" (duplicate: "foo")
56
-     */
57
-    public function testGetMockGeneratorFails()
58
-    {
59
-        $this->generator->getMock(stdClass::class, ['foo', 'bar', 'foo']);
60
-    }
61
-
62
-    /**
63
-     * @requires PHP 7
64
-     */
65
-    public function testGetMockBlacklistedMethodNamesPhp7()
66
-    {
67
-        $mock = $this->generator->getMock(InterfaceWithSemiReservedMethodName::class);
68
-
69
-        $this->assertTrue(method_exists($mock, 'unset'));
70
-        $this->assertInstanceOf(InterfaceWithSemiReservedMethodName::class, $mock);
71
-    }
72
-
73
-    public function testGetMockForAbstractClassDoesNotFailWhenFakingInterfaces()
74
-    {
75
-        $mock = $this->generator->getMockForAbstractClass(Countable::class);
76
-
77
-        $this->assertTrue(method_exists($mock, 'count'));
78
-    }
79
-
80
-    public function testGetMockForAbstractClassStubbingAbstractClass()
81
-    {
82
-        $mock = $this->generator->getMockForAbstractClass(AbstractMockTestClass::class);
83
-
84
-        $this->assertTrue(method_exists($mock, 'doSomething'));
85
-    }
86
-
87
-    public function testGetMockForAbstractClassWithNonExistentMethods()
88
-    {
89
-        $mock = $this->generator->getMockForAbstractClass(
90
-            AbstractMockTestClass::class,
91
-            [],
92
-            '',
93
-            true,
94
-            true,
95
-            true,
96
-            ['nonexistentMethod']
97
-        );
98
-
99
-        $this->assertTrue(method_exists($mock, 'nonexistentMethod'));
100
-        $this->assertTrue(method_exists($mock, 'doSomething'));
101
-    }
102
-
103
-    public function testGetMockForAbstractClassShouldCreateStubsOnlyForAbstractMethodWhenNoMethodsWereInformed()
104
-    {
105
-        $mock = $this->generator->getMockForAbstractClass(AbstractMockTestClass::class);
106
-
107
-        $mock->expects($this->any())
108
-             ->method('doSomething')
109
-             ->willReturn('testing');
110
-
111
-        $this->assertEquals('testing', $mock->doSomething());
112
-        $this->assertEquals(1, $mock->returnAnything());
113
-    }
114
-
115
-    /**
116
-     * @dataProvider getMockForAbstractClassExpectsInvalidArgumentExceptionDataprovider
117
-     * @expectedException PHPUnit\Framework\Exception
118
-     */
119
-    public function testGetMockForAbstractClassExpectingInvalidArgumentException($className, $mockClassName)
120
-    {
121
-        $this->generator->getMockForAbstractClass($className, [], $mockClassName);
122
-    }
123
-
124
-    /**
125
-     * @expectedException PHPUnit_Framework_MockObject_RuntimeException
126
-     */
127
-    public function testGetMockForAbstractClassAbstractClassDoesNotExist()
128
-    {
129
-        $this->generator->getMockForAbstractClass('Tux');
130
-    }
131
-
132
-    public function getMockForAbstractClassExpectsInvalidArgumentExceptionDataprovider()
133
-    {
134
-        return [
135
-            'className not a string'     => [[], ''],
136
-            'mockClassName not a string' => [Countable::class, new stdClass],
137
-        ];
138
-    }
139
-
140
-    public function testGetMockForTraitWithNonExistentMethodsAndNonAbstractMethods()
141
-    {
142
-        $mock = $this->generator->getMockForTrait(
143
-            AbstractTrait::class,
144
-            [],
145
-            '',
146
-            true,
147
-            true,
148
-            true,
149
-            ['nonexistentMethod']
150
-        );
151
-
152
-        $this->assertTrue(method_exists($mock, 'nonexistentMethod'));
153
-        $this->assertTrue(method_exists($mock, 'doSomething'));
154
-        $this->assertTrue($mock->mockableMethod());
155
-        $this->assertTrue($mock->anotherMockableMethod());
156
-    }
157
-
158
-    public function testGetMockForTraitStubbingAbstractMethod()
159
-    {
160
-        $mock = $this->generator->getMockForTrait(AbstractTrait::class);
161
-
162
-        $this->assertTrue(method_exists($mock, 'doSomething'));
163
-    }
164
-
165
-    public function testGetMockForSingletonWithReflectionSuccess()
166
-    {
167
-        $mock = $this->generator->getMock(SingletonClass::class, ['doSomething'], [], '', false);
168
-
169
-        $this->assertInstanceOf('SingletonClass', $mock);
170
-    }
171
-
172
-    /**
173
-     * @expectedException PHPUnit_Framework_MockObject_RuntimeException
174
-     */
175
-    public function testExceptionIsRaisedForMutuallyExclusiveOptions()
176
-    {
177
-        $this->generator->getMock(stdClass::class, [], [], '', false, true, true, true, true);
178
-    }
179
-
180
-    /**
181
-     * @requires PHP 7
182
-     */
183
-    public function testCanImplementInterfacesThatHaveMethodsWithReturnTypes()
184
-    {
185
-        $stub = $this->generator->getMock([AnInterfaceWithReturnType::class, AnInterface::class]);
186
-
187
-        $this->assertInstanceOf(AnInterfaceWithReturnType::class, $stub);
188
-        $this->assertInstanceOf(AnInterface::class, $stub);
189
-        $this->assertInstanceOf(PHPUnit_Framework_MockObject_MockObject::class, $stub);
190
-    }
191
-
192
-    public function testCanConfigureMethodsForDoubleOfNonExistentClass()
193
-    {
194
-        $className = 'X' . md5(microtime());
195
-
196
-        $mock = $this->generator->getMock($className, ['someMethod']);
197
-
198
-        $this->assertInstanceOf($className, $mock);
199
-    }
200
-
201
-    public function testCanInvokeMethodsOfNonExistentClass()
202
-    {
203
-        $className = 'X' . md5(microtime());
204
-
205
-        $mock = $this->generator->getMock($className, ['someMethod']);
206
-
207
-        $mock->expects($this->once())->method('someMethod');
208
-
209
-        $this->assertNull($mock->someMethod());
210
-    }
28
+	/**
29
+	 * @var PHPUnit_Framework_MockObject_Generator
30
+	 */
31
+	private $generator;
32
+
33
+	protected function setUp()
34
+	{
35
+		$this->generator = new PHPUnit_Framework_MockObject_Generator;
36
+	}
37
+
38
+	/**
39
+	 * @expectedException PHPUnit_Framework_MockObject_RuntimeException
40
+	 */
41
+	public function testGetMockFailsWhenInvalidFunctionNameIsPassedInAsAFunctionToMock()
42
+	{
43
+		$this->generator->getMock(stdClass::class, [0]);
44
+	}
45
+
46
+	public function testGetMockCanCreateNonExistingFunctions()
47
+	{
48
+		$mock = $this->generator->getMock(stdClass::class, ['testFunction']);
49
+
50
+		$this->assertTrue(method_exists($mock, 'testFunction'));
51
+	}
52
+
53
+	/**
54
+	 * @expectedException PHPUnit_Framework_MockObject_RuntimeException
55
+	 * @expectedExceptionMessage duplicates: "foo, bar, foo" (duplicate: "foo")
56
+	 */
57
+	public function testGetMockGeneratorFails()
58
+	{
59
+		$this->generator->getMock(stdClass::class, ['foo', 'bar', 'foo']);
60
+	}
61
+
62
+	/**
63
+	 * @requires PHP 7
64
+	 */
65
+	public function testGetMockBlacklistedMethodNamesPhp7()
66
+	{
67
+		$mock = $this->generator->getMock(InterfaceWithSemiReservedMethodName::class);
68
+
69
+		$this->assertTrue(method_exists($mock, 'unset'));
70
+		$this->assertInstanceOf(InterfaceWithSemiReservedMethodName::class, $mock);
71
+	}
72
+
73
+	public function testGetMockForAbstractClassDoesNotFailWhenFakingInterfaces()
74
+	{
75
+		$mock = $this->generator->getMockForAbstractClass(Countable::class);
76
+
77
+		$this->assertTrue(method_exists($mock, 'count'));
78
+	}
79
+
80
+	public function testGetMockForAbstractClassStubbingAbstractClass()
81
+	{
82
+		$mock = $this->generator->getMockForAbstractClass(AbstractMockTestClass::class);
83
+
84
+		$this->assertTrue(method_exists($mock, 'doSomething'));
85
+	}
86
+
87
+	public function testGetMockForAbstractClassWithNonExistentMethods()
88
+	{
89
+		$mock = $this->generator->getMockForAbstractClass(
90
+			AbstractMockTestClass::class,
91
+			[],
92
+			'',
93
+			true,
94
+			true,
95
+			true,
96
+			['nonexistentMethod']
97
+		);
98
+
99
+		$this->assertTrue(method_exists($mock, 'nonexistentMethod'));
100
+		$this->assertTrue(method_exists($mock, 'doSomething'));
101
+	}
102
+
103
+	public function testGetMockForAbstractClassShouldCreateStubsOnlyForAbstractMethodWhenNoMethodsWereInformed()
104
+	{
105
+		$mock = $this->generator->getMockForAbstractClass(AbstractMockTestClass::class);
106
+
107
+		$mock->expects($this->any())
108
+			 ->method('doSomething')
109
+			 ->willReturn('testing');
110
+
111
+		$this->assertEquals('testing', $mock->doSomething());
112
+		$this->assertEquals(1, $mock->returnAnything());
113
+	}
114
+
115
+	/**
116
+	 * @dataProvider getMockForAbstractClassExpectsInvalidArgumentExceptionDataprovider
117
+	 * @expectedException PHPUnit\Framework\Exception
118
+	 */
119
+	public function testGetMockForAbstractClassExpectingInvalidArgumentException($className, $mockClassName)
120
+	{
121
+		$this->generator->getMockForAbstractClass($className, [], $mockClassName);
122
+	}
123
+
124
+	/**
125
+	 * @expectedException PHPUnit_Framework_MockObject_RuntimeException
126
+	 */
127
+	public function testGetMockForAbstractClassAbstractClassDoesNotExist()
128
+	{
129
+		$this->generator->getMockForAbstractClass('Tux');
130
+	}
131
+
132
+	public function getMockForAbstractClassExpectsInvalidArgumentExceptionDataprovider()
133
+	{
134
+		return [
135
+			'className not a string'     => [[], ''],
136
+			'mockClassName not a string' => [Countable::class, new stdClass],
137
+		];
138
+	}
139
+
140
+	public function testGetMockForTraitWithNonExistentMethodsAndNonAbstractMethods()
141
+	{
142
+		$mock = $this->generator->getMockForTrait(
143
+			AbstractTrait::class,
144
+			[],
145
+			'',
146
+			true,
147
+			true,
148
+			true,
149
+			['nonexistentMethod']
150
+		);
151
+
152
+		$this->assertTrue(method_exists($mock, 'nonexistentMethod'));
153
+		$this->assertTrue(method_exists($mock, 'doSomething'));
154
+		$this->assertTrue($mock->mockableMethod());
155
+		$this->assertTrue($mock->anotherMockableMethod());
156
+	}
157
+
158
+	public function testGetMockForTraitStubbingAbstractMethod()
159
+	{
160
+		$mock = $this->generator->getMockForTrait(AbstractTrait::class);
161
+
162
+		$this->assertTrue(method_exists($mock, 'doSomething'));
163
+	}
164
+
165
+	public function testGetMockForSingletonWithReflectionSuccess()
166
+	{
167
+		$mock = $this->generator->getMock(SingletonClass::class, ['doSomething'], [], '', false);
168
+
169
+		$this->assertInstanceOf('SingletonClass', $mock);
170
+	}
171
+
172
+	/**
173
+	 * @expectedException PHPUnit_Framework_MockObject_RuntimeException
174
+	 */
175
+	public function testExceptionIsRaisedForMutuallyExclusiveOptions()
176
+	{
177
+		$this->generator->getMock(stdClass::class, [], [], '', false, true, true, true, true);
178
+	}
179
+
180
+	/**
181
+	 * @requires PHP 7
182
+	 */
183
+	public function testCanImplementInterfacesThatHaveMethodsWithReturnTypes()
184
+	{
185
+		$stub = $this->generator->getMock([AnInterfaceWithReturnType::class, AnInterface::class]);
186
+
187
+		$this->assertInstanceOf(AnInterfaceWithReturnType::class, $stub);
188
+		$this->assertInstanceOf(AnInterface::class, $stub);
189
+		$this->assertInstanceOf(PHPUnit_Framework_MockObject_MockObject::class, $stub);
190
+	}
191
+
192
+	public function testCanConfigureMethodsForDoubleOfNonExistentClass()
193
+	{
194
+		$className = 'X' . md5(microtime());
195
+
196
+		$mock = $this->generator->getMock($className, ['someMethod']);
197
+
198
+		$this->assertInstanceOf($className, $mock);
199
+	}
200
+
201
+	public function testCanInvokeMethodsOfNonExistentClass()
202
+	{
203
+		$className = 'X' . md5(microtime());
204
+
205
+		$mock = $this->generator->getMock($className, ['someMethod']);
206
+
207
+		$mock->expects($this->once())->method('someMethod');
208
+
209
+		$this->assertNull($mock->someMethod());
210
+	}
211 211
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
     public function testCanConfigureMethodsForDoubleOfNonExistentClass()
193 193
     {
194
-        $className = 'X' . md5(microtime());
194
+        $className = 'X'.md5(microtime());
195 195
 
196 196
         $mock = $this->generator->getMock($className, ['someMethod']);
197 197
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
     public function testCanInvokeMethodsOfNonExistentClass()
202 202
     {
203
-        $className = 'X' . md5(microtime());
203
+        $className = 'X'.md5(microtime());
204 204
 
205 205
         $mock = $this->generator->getMock($className, ['someMethod']);
206 206
 
Please login to merge, or discard this patch.
vendor/phpunit/phpunit-mock-objects/tests/Builder/InvocationMockerTest.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -12,63 +12,63 @@
 block discarded – undo
12 12
 
13 13
 class Framework_MockObject_Builder_InvocationMockerTest extends TestCase
14 14
 {
15
-    public function testWillReturnWithOneValue()
16
-    {
17
-        $mock = $this->getMockBuilder(stdClass::class)
18
-                     ->setMethods(['foo'])
19
-                     ->getMock();
15
+	public function testWillReturnWithOneValue()
16
+	{
17
+		$mock = $this->getMockBuilder(stdClass::class)
18
+					 ->setMethods(['foo'])
19
+					 ->getMock();
20 20
 
21
-        $mock->expects($this->any())
22
-             ->method('foo')
23
-             ->willReturn(1);
21
+		$mock->expects($this->any())
22
+			 ->method('foo')
23
+			 ->willReturn(1);
24 24
 
25
-        $this->assertEquals(1, $mock->foo());
26
-    }
25
+		$this->assertEquals(1, $mock->foo());
26
+	}
27 27
 
28
-    public function testWillReturnWithMultipleValues()
29
-    {
30
-        $mock = $this->getMockBuilder(stdClass::class)
31
-                     ->setMethods(['foo'])
32
-                     ->getMock();
28
+	public function testWillReturnWithMultipleValues()
29
+	{
30
+		$mock = $this->getMockBuilder(stdClass::class)
31
+					 ->setMethods(['foo'])
32
+					 ->getMock();
33 33
 
34
-        $mock->expects($this->any())
35
-             ->method('foo')
36
-             ->willReturn(1, 2, 3);
34
+		$mock->expects($this->any())
35
+			 ->method('foo')
36
+			 ->willReturn(1, 2, 3);
37 37
 
38
-        $this->assertEquals(1, $mock->foo());
39
-        $this->assertEquals(2, $mock->foo());
40
-        $this->assertEquals(3, $mock->foo());
41
-    }
38
+		$this->assertEquals(1, $mock->foo());
39
+		$this->assertEquals(2, $mock->foo());
40
+		$this->assertEquals(3, $mock->foo());
41
+	}
42 42
 
43
-    public function testWillReturnOnConsecutiveCalls()
44
-    {
45
-        $mock = $this->getMockBuilder(stdClass::class)
46
-                     ->setMethods(['foo'])
47
-                     ->getMock();
43
+	public function testWillReturnOnConsecutiveCalls()
44
+	{
45
+		$mock = $this->getMockBuilder(stdClass::class)
46
+					 ->setMethods(['foo'])
47
+					 ->getMock();
48 48
 
49
-        $mock->expects($this->any())
50
-             ->method('foo')
51
-             ->willReturnOnConsecutiveCalls(1, 2, 3);
49
+		$mock->expects($this->any())
50
+			 ->method('foo')
51
+			 ->willReturnOnConsecutiveCalls(1, 2, 3);
52 52
 
53
-        $this->assertEquals(1, $mock->foo());
54
-        $this->assertEquals(2, $mock->foo());
55
-        $this->assertEquals(3, $mock->foo());
56
-    }
53
+		$this->assertEquals(1, $mock->foo());
54
+		$this->assertEquals(2, $mock->foo());
55
+		$this->assertEquals(3, $mock->foo());
56
+	}
57 57
 
58
-    public function testWillReturnByReference()
59
-    {
60
-        $mock = $this->getMockBuilder(stdClass::class)
61
-                     ->setMethods(['foo'])
62
-                     ->getMock();
58
+	public function testWillReturnByReference()
59
+	{
60
+		$mock = $this->getMockBuilder(stdClass::class)
61
+					 ->setMethods(['foo'])
62
+					 ->getMock();
63 63
 
64
-        $mock->expects($this->any())
65
-             ->method('foo')
66
-             ->willReturnReference($value);
64
+		$mock->expects($this->any())
65
+			 ->method('foo')
66
+			 ->willReturnReference($value);
67 67
 
68
-        $this->assertSame(null, $mock->foo());
69
-        $value = 'foo';
70
-        $this->assertSame('foo', $mock->foo());
71
-        $value = 'bar';
72
-        $this->assertSame('bar', $mock->foo());
73
-    }
68
+		$this->assertSame(null, $mock->foo());
69
+		$value = 'foo';
70
+		$this->assertSame('foo', $mock->foo());
71
+		$value = 'bar';
72
+		$this->assertSame('bar', $mock->foo());
73
+	}
74 74
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit-mock-objects/tests/MockBuilderTest.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -12,117 +12,117 @@
 block discarded – undo
12 12
 
13 13
 class Framework_MockBuilderTest extends TestCase
14 14
 {
15
-    public function testMockBuilderRequiresClassName()
16
-    {
17
-        $mock = $this->getMockBuilder(Mockable::class)->getMock();
18
-
19
-        $this->assertTrue($mock instanceof Mockable);
20
-    }
21
-
22
-    public function testByDefaultMocksAllMethods()
23
-    {
24
-        $mock = $this->getMockBuilder(Mockable::class)->getMock();
25
-
26
-        $this->assertNull($mock->mockableMethod());
27
-        $this->assertNull($mock->anotherMockableMethod());
28
-    }
29
-
30
-    public function testMethodsToMockCanBeSpecified()
31
-    {
32
-        $mock = $this->getMockBuilder(Mockable::class)
33
-                     ->setMethods(['mockableMethod'])
34
-                     ->getMock();
35
-
36
-        $this->assertNull($mock->mockableMethod());
37
-        $this->assertTrue($mock->anotherMockableMethod());
38
-    }
39
-
40
-    public function testMethodExceptionsToMockCanBeSpecified()
41
-    {
42
-        $mock = $this->getMockBuilder(Mockable::class)
43
-            ->setMethodsExcept(['mockableMethod'])
44
-            ->getMock();
45
-
46
-        $this->assertTrue($mock->mockableMethod());
47
-        $this->assertNull($mock->anotherMockableMethod());
48
-    }
49
-
50
-    public function testEmptyMethodExceptionsToMockCanBeSpecified()
51
-    {
52
-        $mock = $this->getMockBuilder(Mockable::class)
53
-            ->setMethodsExcept()
54
-            ->getMock();
55
-
56
-        $this->assertNull($mock->mockableMethod());
57
-        $this->assertNull($mock->anotherMockableMethod());
58
-    }
59
-
60
-    public function testByDefaultDoesNotPassArgumentsToTheConstructor()
61
-    {
62
-        $mock = $this->getMockBuilder(Mockable::class)->getMock();
63
-
64
-        $this->assertEquals([null, null], $mock->constructorArgs);
65
-    }
66
-
67
-    public function testMockClassNameCanBeSpecified()
68
-    {
69
-        $mock = $this->getMockBuilder(Mockable::class)
70
-                     ->setMockClassName('ACustomClassName')
71
-                     ->getMock();
72
-
73
-        $this->assertTrue($mock instanceof ACustomClassName);
74
-    }
75
-
76
-    public function testConstructorArgumentsCanBeSpecified()
77
-    {
78
-        $mock = $this->getMockBuilder(Mockable::class)
79
-                     ->setConstructorArgs([23, 42])
80
-                     ->getMock();
81
-
82
-        $this->assertEquals([23, 42], $mock->constructorArgs);
83
-    }
84
-
85
-    public function testOriginalConstructorCanBeDisabled()
86
-    {
87
-        $mock = $this->getMockBuilder(Mockable::class)
88
-                     ->disableOriginalConstructor()
89
-                     ->getMock();
90
-
91
-        $this->assertNull($mock->constructorArgs);
92
-    }
93
-
94
-    public function testByDefaultOriginalCloneIsPreserved()
95
-    {
96
-        $mock = $this->getMockBuilder(Mockable::class)
97
-                     ->getMock();
98
-
99
-        $cloned = clone $mock;
100
-
101
-        $this->assertTrue($cloned->cloned);
102
-    }
103
-
104
-    public function testOriginalCloneCanBeDisabled()
105
-    {
106
-        $mock = $this->getMockBuilder(Mockable::class)
107
-                     ->disableOriginalClone()
108
-                     ->getMock();
109
-
110
-        $mock->cloned = false;
111
-        $cloned       = clone $mock;
112
-
113
-        $this->assertFalse($cloned->cloned);
114
-    }
115
-
116
-    public function testProvidesAFluentInterface()
117
-    {
118
-        $spec = $this->getMockBuilder(Mockable::class)
119
-                     ->setMethods(['mockableMethod'])
120
-                     ->setConstructorArgs([])
121
-                     ->setMockClassName('DummyClassName')
122
-                     ->disableOriginalConstructor()
123
-                     ->disableOriginalClone()
124
-                     ->disableAutoload();
125
-
126
-        $this->assertTrue($spec instanceof PHPUnit_Framework_MockObject_MockBuilder);
127
-    }
15
+	public function testMockBuilderRequiresClassName()
16
+	{
17
+		$mock = $this->getMockBuilder(Mockable::class)->getMock();
18
+
19
+		$this->assertTrue($mock instanceof Mockable);
20
+	}
21
+
22
+	public function testByDefaultMocksAllMethods()
23
+	{
24
+		$mock = $this->getMockBuilder(Mockable::class)->getMock();
25
+
26
+		$this->assertNull($mock->mockableMethod());
27
+		$this->assertNull($mock->anotherMockableMethod());
28
+	}
29
+
30
+	public function testMethodsToMockCanBeSpecified()
31
+	{
32
+		$mock = $this->getMockBuilder(Mockable::class)
33
+					 ->setMethods(['mockableMethod'])
34
+					 ->getMock();
35
+
36
+		$this->assertNull($mock->mockableMethod());
37
+		$this->assertTrue($mock->anotherMockableMethod());
38
+	}
39
+
40
+	public function testMethodExceptionsToMockCanBeSpecified()
41
+	{
42
+		$mock = $this->getMockBuilder(Mockable::class)
43
+			->setMethodsExcept(['mockableMethod'])
44
+			->getMock();
45
+
46
+		$this->assertTrue($mock->mockableMethod());
47
+		$this->assertNull($mock->anotherMockableMethod());
48
+	}
49
+
50
+	public function testEmptyMethodExceptionsToMockCanBeSpecified()
51
+	{
52
+		$mock = $this->getMockBuilder(Mockable::class)
53
+			->setMethodsExcept()
54
+			->getMock();
55
+
56
+		$this->assertNull($mock->mockableMethod());
57
+		$this->assertNull($mock->anotherMockableMethod());
58
+	}
59
+
60
+	public function testByDefaultDoesNotPassArgumentsToTheConstructor()
61
+	{
62
+		$mock = $this->getMockBuilder(Mockable::class)->getMock();
63
+
64
+		$this->assertEquals([null, null], $mock->constructorArgs);
65
+	}
66
+
67
+	public function testMockClassNameCanBeSpecified()
68
+	{
69
+		$mock = $this->getMockBuilder(Mockable::class)
70
+					 ->setMockClassName('ACustomClassName')
71
+					 ->getMock();
72
+
73
+		$this->assertTrue($mock instanceof ACustomClassName);
74
+	}
75
+
76
+	public function testConstructorArgumentsCanBeSpecified()
77
+	{
78
+		$mock = $this->getMockBuilder(Mockable::class)
79
+					 ->setConstructorArgs([23, 42])
80
+					 ->getMock();
81
+
82
+		$this->assertEquals([23, 42], $mock->constructorArgs);
83
+	}
84
+
85
+	public function testOriginalConstructorCanBeDisabled()
86
+	{
87
+		$mock = $this->getMockBuilder(Mockable::class)
88
+					 ->disableOriginalConstructor()
89
+					 ->getMock();
90
+
91
+		$this->assertNull($mock->constructorArgs);
92
+	}
93
+
94
+	public function testByDefaultOriginalCloneIsPreserved()
95
+	{
96
+		$mock = $this->getMockBuilder(Mockable::class)
97
+					 ->getMock();
98
+
99
+		$cloned = clone $mock;
100
+
101
+		$this->assertTrue($cloned->cloned);
102
+	}
103
+
104
+	public function testOriginalCloneCanBeDisabled()
105
+	{
106
+		$mock = $this->getMockBuilder(Mockable::class)
107
+					 ->disableOriginalClone()
108
+					 ->getMock();
109
+
110
+		$mock->cloned = false;
111
+		$cloned       = clone $mock;
112
+
113
+		$this->assertFalse($cloned->cloned);
114
+	}
115
+
116
+	public function testProvidesAFluentInterface()
117
+	{
118
+		$spec = $this->getMockBuilder(Mockable::class)
119
+					 ->setMethods(['mockableMethod'])
120
+					 ->setConstructorArgs([])
121
+					 ->setMockClassName('DummyClassName')
122
+					 ->disableOriginalConstructor()
123
+					 ->disableOriginalClone()
124
+					 ->disableAutoload();
125
+
126
+		$this->assertTrue($spec instanceof PHPUnit_Framework_MockObject_MockBuilder);
127
+	}
128 128
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit-mock-objects/src/Stub.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@
 block discarded – undo
18 18
  */
19 19
 interface PHPUnit_Framework_MockObject_Stub extends SelfDescribing
20 20
 {
21
-    /**
22
-     * Fakes the processing of the invocation $invocation by returning a
23
-     * specific value.
24
-     *
25
-     * @param PHPUnit_Framework_MockObject_Invocation $invocation The invocation which was mocked and matched by the current method and argument matchers
26
-     *
27
-     * @return mixed
28
-     */
29
-    public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation);
21
+	/**
22
+	 * Fakes the processing of the invocation $invocation by returning a
23
+	 * specific value.
24
+	 *
25
+	 * @param PHPUnit_Framework_MockObject_Invocation $invocation The invocation which was mocked and matched by the current method and argument matchers
26
+	 *
27
+	 * @return mixed
28
+	 */
29
+	public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation);
30 30
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit-mock-objects/src/Invocation/Static.php 2 patches
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -16,194 +16,194 @@
 block discarded – undo
16 16
  */
17 17
 class PHPUnit_Framework_MockObject_Invocation_Static implements PHPUnit_Framework_MockObject_Invocation, SelfDescribing
18 18
 {
19
-    /**
20
-     * @var array
21
-     */
22
-    protected static $uncloneableExtensions = [
23
-        'mysqli'    => true,
24
-        'SQLite'    => true,
25
-        'sqlite3'   => true,
26
-        'tidy'      => true,
27
-        'xmlwriter' => true,
28
-        'xsl'       => true
29
-    ];
30
-
31
-    /**
32
-     * @var array
33
-     */
34
-    protected static $uncloneableClasses = [
35
-        'Closure',
36
-        'COMPersistHelper',
37
-        'IteratorIterator',
38
-        'RecursiveIteratorIterator',
39
-        'SplFileObject',
40
-        'PDORow',
41
-        'ZipArchive'
42
-    ];
43
-
44
-    /**
45
-     * @var string
46
-     */
47
-    public $className;
48
-
49
-    /**
50
-     * @var string
51
-     */
52
-    public $methodName;
53
-
54
-    /**
55
-     * @var array
56
-     */
57
-    public $parameters;
58
-
59
-    /**
60
-     * @var string
61
-     */
62
-    public $returnType;
63
-
64
-    /**
65
-     * @var bool
66
-     */
67
-    public $returnTypeNullable = false;
68
-
69
-    /**
70
-     * @param string $className
71
-     * @param string $methodName
72
-     * @param array  $parameters
73
-     * @param string $returnType
74
-     * @param bool   $cloneObjects
75
-     */
76
-    public function __construct($className, $methodName, array $parameters, $returnType, $cloneObjects = false)
77
-    {
78
-        $this->className  = $className;
79
-        $this->methodName = $methodName;
80
-        $this->parameters = $parameters;
81
-
82
-        if (strpos($returnType, '?') === 0) {
83
-            $returnType               = substr($returnType, 1);
84
-            $this->returnTypeNullable = true;
85
-        }
86
-
87
-        $this->returnType = $returnType;
88
-
89
-        if (!$cloneObjects) {
90
-            return;
91
-        }
92
-
93
-        foreach ($this->parameters as $key => $value) {
94
-            if (is_object($value)) {
95
-                $this->parameters[$key] = $this->cloneObject($value);
96
-            }
97
-        }
98
-    }
99
-
100
-    /**
101
-     * @return string
102
-     */
103
-    public function toString()
104
-    {
105
-        $exporter = new Exporter;
106
-
107
-        return sprintf(
108
-            '%s::%s(%s)%s',
109
-            $this->className,
110
-            $this->methodName,
111
-            implode(
112
-                ', ',
113
-                array_map(
114
-                    [$exporter, 'shortenedExport'],
115
-                    $this->parameters
116
-                )
117
-            ),
118
-            $this->returnType ? sprintf(': %s', $this->returnType) : ''
119
-        );
120
-    }
121
-
122
-    /**
123
-     * @return mixed Mocked return value.
124
-     */
125
-    public function generateReturnValue()
126
-    {
127
-        switch ($this->returnType) {
128
-            case '':       return;
129
-            case 'string': return $this->returnTypeNullable ? null : '';
130
-            case 'float':  return $this->returnTypeNullable ? null : 0.0;
131
-            case 'int':    return $this->returnTypeNullable ? null : 0;
132
-            case 'bool':   return $this->returnTypeNullable ? null : false;
133
-            case 'array':  return $this->returnTypeNullable ? null : [];
134
-            case 'void':   return;
135
-
136
-            case 'callable':
137
-            case 'Closure':
138
-                return function () {
139
-                };
140
-
141
-            case 'Traversable':
142
-            case 'Generator':
143
-                $generator = function () {
144
-                    yield;
145
-                };
146
-
147
-                return $generator();
148
-
149
-            default:
150
-                if ($this->returnTypeNullable) {
151
-                    return;
152
-                }
153
-
154
-                $generator = new PHPUnit_Framework_MockObject_Generator;
155
-
156
-                return $generator->getMock($this->returnType, [], [], '', false);
157
-        }
158
-    }
159
-
160
-    /**
161
-     * @param object $original
162
-     *
163
-     * @return object
164
-     */
165
-    protected function cloneObject($original)
166
-    {
167
-        $cloneable = null;
168
-        $object    = new ReflectionObject($original);
169
-
170
-        // Check the blacklist before asking PHP reflection to work around
171
-        // https://bugs.php.net/bug.php?id=53967
172
-        if ($object->isInternal() &&
173
-            isset(self::$uncloneableExtensions[$object->getExtensionName()])) {
174
-            $cloneable = false;
175
-        }
176
-
177
-        if ($cloneable === null) {
178
-            foreach (self::$uncloneableClasses as $class) {
179
-                if ($original instanceof $class) {
180
-                    $cloneable = false;
181
-                    break;
182
-                }
183
-            }
184
-        }
185
-
186
-        if ($cloneable === null && method_exists($object, 'isCloneable')) {
187
-            $cloneable = $object->isCloneable();
188
-        }
189
-
190
-        if ($cloneable === null && $object->hasMethod('__clone')) {
191
-            $method    = $object->getMethod('__clone');
192
-            $cloneable = $method->isPublic();
193
-        }
194
-
195
-        if ($cloneable === null) {
196
-            $cloneable = true;
197
-        }
198
-
199
-        if ($cloneable) {
200
-            try {
201
-                return clone $original;
202
-            } catch (Exception $e) {
203
-                return $original;
204
-            }
205
-        } else {
206
-            return $original;
207
-        }
208
-    }
19
+	/**
20
+	 * @var array
21
+	 */
22
+	protected static $uncloneableExtensions = [
23
+		'mysqli'    => true,
24
+		'SQLite'    => true,
25
+		'sqlite3'   => true,
26
+		'tidy'      => true,
27
+		'xmlwriter' => true,
28
+		'xsl'       => true
29
+	];
30
+
31
+	/**
32
+	 * @var array
33
+	 */
34
+	protected static $uncloneableClasses = [
35
+		'Closure',
36
+		'COMPersistHelper',
37
+		'IteratorIterator',
38
+		'RecursiveIteratorIterator',
39
+		'SplFileObject',
40
+		'PDORow',
41
+		'ZipArchive'
42
+	];
43
+
44
+	/**
45
+	 * @var string
46
+	 */
47
+	public $className;
48
+
49
+	/**
50
+	 * @var string
51
+	 */
52
+	public $methodName;
53
+
54
+	/**
55
+	 * @var array
56
+	 */
57
+	public $parameters;
58
+
59
+	/**
60
+	 * @var string
61
+	 */
62
+	public $returnType;
63
+
64
+	/**
65
+	 * @var bool
66
+	 */
67
+	public $returnTypeNullable = false;
68
+
69
+	/**
70
+	 * @param string $className
71
+	 * @param string $methodName
72
+	 * @param array  $parameters
73
+	 * @param string $returnType
74
+	 * @param bool   $cloneObjects
75
+	 */
76
+	public function __construct($className, $methodName, array $parameters, $returnType, $cloneObjects = false)
77
+	{
78
+		$this->className  = $className;
79
+		$this->methodName = $methodName;
80
+		$this->parameters = $parameters;
81
+
82
+		if (strpos($returnType, '?') === 0) {
83
+			$returnType               = substr($returnType, 1);
84
+			$this->returnTypeNullable = true;
85
+		}
86
+
87
+		$this->returnType = $returnType;
88
+
89
+		if (!$cloneObjects) {
90
+			return;
91
+		}
92
+
93
+		foreach ($this->parameters as $key => $value) {
94
+			if (is_object($value)) {
95
+				$this->parameters[$key] = $this->cloneObject($value);
96
+			}
97
+		}
98
+	}
99
+
100
+	/**
101
+	 * @return string
102
+	 */
103
+	public function toString()
104
+	{
105
+		$exporter = new Exporter;
106
+
107
+		return sprintf(
108
+			'%s::%s(%s)%s',
109
+			$this->className,
110
+			$this->methodName,
111
+			implode(
112
+				', ',
113
+				array_map(
114
+					[$exporter, 'shortenedExport'],
115
+					$this->parameters
116
+				)
117
+			),
118
+			$this->returnType ? sprintf(': %s', $this->returnType) : ''
119
+		);
120
+	}
121
+
122
+	/**
123
+	 * @return mixed Mocked return value.
124
+	 */
125
+	public function generateReturnValue()
126
+	{
127
+		switch ($this->returnType) {
128
+			case '':       return;
129
+			case 'string': return $this->returnTypeNullable ? null : '';
130
+			case 'float':  return $this->returnTypeNullable ? null : 0.0;
131
+			case 'int':    return $this->returnTypeNullable ? null : 0;
132
+			case 'bool':   return $this->returnTypeNullable ? null : false;
133
+			case 'array':  return $this->returnTypeNullable ? null : [];
134
+			case 'void':   return;
135
+
136
+			case 'callable':
137
+			case 'Closure':
138
+				return function () {
139
+				};
140
+
141
+			case 'Traversable':
142
+			case 'Generator':
143
+				$generator = function () {
144
+					yield;
145
+				};
146
+
147
+				return $generator();
148
+
149
+			default:
150
+				if ($this->returnTypeNullable) {
151
+					return;
152
+				}
153
+
154
+				$generator = new PHPUnit_Framework_MockObject_Generator;
155
+
156
+				return $generator->getMock($this->returnType, [], [], '', false);
157
+		}
158
+	}
159
+
160
+	/**
161
+	 * @param object $original
162
+	 *
163
+	 * @return object
164
+	 */
165
+	protected function cloneObject($original)
166
+	{
167
+		$cloneable = null;
168
+		$object    = new ReflectionObject($original);
169
+
170
+		// Check the blacklist before asking PHP reflection to work around
171
+		// https://bugs.php.net/bug.php?id=53967
172
+		if ($object->isInternal() &&
173
+			isset(self::$uncloneableExtensions[$object->getExtensionName()])) {
174
+			$cloneable = false;
175
+		}
176
+
177
+		if ($cloneable === null) {
178
+			foreach (self::$uncloneableClasses as $class) {
179
+				if ($original instanceof $class) {
180
+					$cloneable = false;
181
+					break;
182
+				}
183
+			}
184
+		}
185
+
186
+		if ($cloneable === null && method_exists($object, 'isCloneable')) {
187
+			$cloneable = $object->isCloneable();
188
+		}
189
+
190
+		if ($cloneable === null && $object->hasMethod('__clone')) {
191
+			$method    = $object->getMethod('__clone');
192
+			$cloneable = $method->isPublic();
193
+		}
194
+
195
+		if ($cloneable === null) {
196
+			$cloneable = true;
197
+		}
198
+
199
+		if ($cloneable) {
200
+			try {
201
+				return clone $original;
202
+			} catch (Exception $e) {
203
+				return $original;
204
+			}
205
+		} else {
206
+			return $original;
207
+		}
208
+	}
209 209
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -135,12 +135,12 @@
 block discarded – undo
135 135
 
136 136
             case 'callable':
137 137
             case 'Closure':
138
-                return function () {
138
+                return function() {
139 139
                 };
140 140
 
141 141
             case 'Traversable':
142 142
             case 'Generator':
143
-                $generator = function () {
143
+                $generator = function() {
144 144
                     yield;
145 145
                 };
146 146
 
Please login to merge, or discard this patch.
vendor/phpunit/phpunit-mock-objects/src/Invocation/Object.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@
 block discarded – undo
13 13
  */
14 14
 class PHPUnit_Framework_MockObject_Invocation_Object extends PHPUnit_Framework_MockObject_Invocation_Static
15 15
 {
16
-    /**
17
-     * @var object
18
-     */
19
-    public $object;
16
+	/**
17
+	 * @var object
18
+	 */
19
+	public $object;
20 20
 
21
-    /**
22
-     * @param string $className
23
-     * @param string $methodName
24
-     * @param array  $parameters
25
-     * @param string $returnType
26
-     * @param object $object
27
-     * @param bool   $cloneObjects
28
-     */
29
-    public function __construct($className, $methodName, array $parameters, $returnType, $object, $cloneObjects = false)
30
-    {
31
-        parent::__construct($className, $methodName, $parameters, $returnType, $cloneObjects);
21
+	/**
22
+	 * @param string $className
23
+	 * @param string $methodName
24
+	 * @param array  $parameters
25
+	 * @param string $returnType
26
+	 * @param object $object
27
+	 * @param bool   $cloneObjects
28
+	 */
29
+	public function __construct($className, $methodName, array $parameters, $returnType, $object, $cloneObjects = false)
30
+	{
31
+		parent::__construct($className, $methodName, $parameters, $returnType, $cloneObjects);
32 32
 
33
-        $this->object = $object;
34
-    }
33
+		$this->object = $object;
34
+	}
35 35
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit-mock-objects/src/Stub/ReturnArgument.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,24 +13,24 @@
 block discarded – undo
13 13
  */
14 14
 class PHPUnit_Framework_MockObject_Stub_ReturnArgument extends PHPUnit_Framework_MockObject_Stub_Return
15 15
 {
16
-    protected $argumentIndex;
16
+	protected $argumentIndex;
17 17
 
18
-    public function __construct($argumentIndex)
19
-    {
20
-        $this->argumentIndex = $argumentIndex;
21
-    }
18
+	public function __construct($argumentIndex)
19
+	{
20
+		$this->argumentIndex = $argumentIndex;
21
+	}
22 22
 
23
-    public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
24
-    {
25
-        if (isset($invocation->parameters[$this->argumentIndex])) {
26
-            return $invocation->parameters[$this->argumentIndex];
27
-        } else {
28
-            return;
29
-        }
30
-    }
23
+	public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
24
+	{
25
+		if (isset($invocation->parameters[$this->argumentIndex])) {
26
+			return $invocation->parameters[$this->argumentIndex];
27
+		} else {
28
+			return;
29
+		}
30
+	}
31 31
 
32
-    public function toString()
33
-    {
34
-        return sprintf('return argument #%d', $this->argumentIndex);
35
-    }
32
+	public function toString()
33
+	{
34
+		return sprintf('return argument #%d', $this->argumentIndex);
35
+	}
36 36
 }
Please login to merge, or discard this patch.