Completed
Push — master ( 52755b...6c4366 )
by smiley
02:13
created
vendor/phpunit/phpunit-mock-objects/tests/_fixture/MockTestInterface.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 interface MockTestInterface
3 3
 {
4
-    public function returnAnything();
5
-    public function returnAnythingElse();
4
+	public function returnAnything();
5
+	public function returnAnythingElse();
6 6
 }
Please login to merge, or discard this patch.
phpunit/phpunit-mock-objects/tests/_fixture/AbstractMockTestClass.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 abstract class AbstractMockTestClass implements MockTestInterface
3 3
 {
4
-    abstract public function doSomething();
4
+	abstract public function doSomething();
5 5
 
6
-    public function returnAnything()
7
-    {
8
-        return 1;
9
-    }
6
+	public function returnAnything()
7
+	{
8
+		return 1;
9
+	}
10 10
 }
Please login to merge, or discard this patch.
vendor/phpunit/phpunit-mock-objects/tests/Invocation/ObjectTest.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -12,108 +12,108 @@
 block discarded – undo
12 12
 
13 13
 class Framework_MockObject_Invocation_ObjectTest extends TestCase
14 14
 {
15
-    public function testConstructorRequiresClassAndMethodAndParametersAndObject()
16
-    {
17
-        $this->assertInstanceOf(
18
-            PHPUnit_Framework_MockObject_Invocation_Object::class,
19
-            new PHPUnit_Framework_MockObject_Invocation_Object(
20
-                'FooClass',
21
-                'FooMethod',
22
-                ['an_argument'],
23
-                'ReturnType',
24
-                new stdClass
25
-            )
26
-        );
27
-    }
28
-
29
-    public function testAllowToGetClassNameSetInConstructor()
30
-    {
31
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
32
-            'FooClass',
33
-            'FooMethod',
34
-            ['an_argument'],
35
-            'ReturnType',
36
-            new stdClass
37
-        );
38
-
39
-        $this->assertSame('FooClass', $invocation->className);
40
-    }
41
-
42
-    public function testAllowToGetMethodNameSetInConstructor()
43
-    {
44
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
45
-            'FooClass',
46
-            'FooMethod',
47
-            ['an_argument'],
48
-            'ReturnType',
49
-            new stdClass
50
-        );
51
-
52
-        $this->assertSame('FooMethod', $invocation->methodName);
53
-    }
54
-
55
-    public function testAllowToGetObjectSetInConstructor()
56
-    {
57
-        $expectedObject = new stdClass;
58
-
59
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
60
-            'FooClass',
61
-            'FooMethod',
62
-            ['an_argument'],
63
-            'ReturnType',
64
-            $expectedObject
65
-        );
66
-
67
-        $this->assertSame($expectedObject, $invocation->object);
68
-    }
69
-
70
-    public function testAllowToGetMethodParametersSetInConstructor()
71
-    {
72
-        $expectedParameters = [
73
-          'foo', 5, ['a', 'b'], new stdClass, null, false
74
-        ];
75
-
76
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
77
-            'FooClass',
78
-            'FooMethod',
79
-            $expectedParameters,
80
-            'ReturnType',
81
-            new stdClass
82
-        );
83
-
84
-        $this->assertSame($expectedParameters, $invocation->parameters);
85
-    }
86
-
87
-    public function testConstructorAllowToSetFlagCloneObjectsInParameters()
88
-    {
89
-        $parameters   = [new stdClass];
90
-        $cloneObjects = true;
91
-
92
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
93
-            'FooClass',
94
-            'FooMethod',
95
-            $parameters,
96
-            'ReturnType',
97
-            new stdClass,
98
-            $cloneObjects
99
-        );
100
-
101
-        $this->assertEquals($parameters, $invocation->parameters);
102
-        $this->assertNotSame($parameters, $invocation->parameters);
103
-    }
104
-
105
-    public function testAllowToGetReturnTypeSetInConstructor()
106
-    {
107
-        $expectedReturnType = 'string';
108
-
109
-        $invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
110
-            'FooClass',
111
-            'FooMethod',
112
-            ['an_argument'],
113
-            $expectedReturnType,
114
-            new stdClass
115
-        );
116
-
117
-        $this->assertSame($expectedReturnType, $invocation->returnType);
118
-    }
15
+	public function testConstructorRequiresClassAndMethodAndParametersAndObject()
16
+	{
17
+		$this->assertInstanceOf(
18
+			PHPUnit_Framework_MockObject_Invocation_Object::class,
19
+			new PHPUnit_Framework_MockObject_Invocation_Object(
20
+				'FooClass',
21
+				'FooMethod',
22
+				['an_argument'],
23
+				'ReturnType',
24
+				new stdClass
25
+			)
26
+		);
27
+	}
28
+
29
+	public function testAllowToGetClassNameSetInConstructor()
30
+	{
31
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
32
+			'FooClass',
33
+			'FooMethod',
34
+			['an_argument'],
35
+			'ReturnType',
36
+			new stdClass
37
+		);
38
+
39
+		$this->assertSame('FooClass', $invocation->className);
40
+	}
41
+
42
+	public function testAllowToGetMethodNameSetInConstructor()
43
+	{
44
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
45
+			'FooClass',
46
+			'FooMethod',
47
+			['an_argument'],
48
+			'ReturnType',
49
+			new stdClass
50
+		);
51
+
52
+		$this->assertSame('FooMethod', $invocation->methodName);
53
+	}
54
+
55
+	public function testAllowToGetObjectSetInConstructor()
56
+	{
57
+		$expectedObject = new stdClass;
58
+
59
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
60
+			'FooClass',
61
+			'FooMethod',
62
+			['an_argument'],
63
+			'ReturnType',
64
+			$expectedObject
65
+		);
66
+
67
+		$this->assertSame($expectedObject, $invocation->object);
68
+	}
69
+
70
+	public function testAllowToGetMethodParametersSetInConstructor()
71
+	{
72
+		$expectedParameters = [
73
+		  'foo', 5, ['a', 'b'], new stdClass, null, false
74
+		];
75
+
76
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
77
+			'FooClass',
78
+			'FooMethod',
79
+			$expectedParameters,
80
+			'ReturnType',
81
+			new stdClass
82
+		);
83
+
84
+		$this->assertSame($expectedParameters, $invocation->parameters);
85
+	}
86
+
87
+	public function testConstructorAllowToSetFlagCloneObjectsInParameters()
88
+	{
89
+		$parameters   = [new stdClass];
90
+		$cloneObjects = true;
91
+
92
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
93
+			'FooClass',
94
+			'FooMethod',
95
+			$parameters,
96
+			'ReturnType',
97
+			new stdClass,
98
+			$cloneObjects
99
+		);
100
+
101
+		$this->assertEquals($parameters, $invocation->parameters);
102
+		$this->assertNotSame($parameters, $invocation->parameters);
103
+	}
104
+
105
+	public function testAllowToGetReturnTypeSetInConstructor()
106
+	{
107
+		$expectedReturnType = 'string';
108
+
109
+		$invocation = new PHPUnit_Framework_MockObject_Invocation_Object(
110
+			'FooClass',
111
+			'FooMethod',
112
+			['an_argument'],
113
+			$expectedReturnType,
114
+			new stdClass
115
+		);
116
+
117
+		$this->assertSame($expectedReturnType, $invocation->returnType);
118
+	}
119 119
 }
Please login to merge, or discard this patch.
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 1 patch
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.
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.