Skip to content

Commit e9dc943

Browse files
committed
minor #4223 [7.3] PhpUnitMockFixer - add tests for PHP 7.3 (kubawerlos)
This PR was merged into the 2.12 branch. Discussion ---------- [7.3] PhpUnitMockFixer - add tests for PHP 7.3 Ping @keradus (as original author) for review. Commits ------- 7d2e747 PhpUnitMockFixer - add tests for PHP 7.3
2 parents f18ac97 + 7d2e747 commit e9dc943

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

tests/Fixer/PhpUnit/PhpUnitMockFixerTest.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,47 @@ public function testFoo()
107107
],
108108
];
109109
}
110+
111+
/**
112+
* @requires PHP 7.3
113+
*/
114+
public function testFix73()
115+
{
116+
$this->doTest(
117+
'<?php
118+
class FooTest extends TestCase
119+
{
120+
public function testFoo()
121+
{
122+
$this->createMock("Foo",);
123+
$this->createMock("Bar" ,);
124+
$this->createMock("Baz" , );
125+
$this->createMock($foo(1, 2), );
126+
$this->createMock($foo(3, 4, ));
127+
$this->createMock($foo(5, 6, ), );
128+
$this->createPartialMock("Foo", ["aaa"], );
129+
$this->createPartialMock("Foo", ["bbb", ], );
130+
$this->getMock("Foo", ["aaa"], ["argument"], );
131+
$this->getMock("Foo", ["bbb", ], ["argument", ], );
132+
}
133+
}',
134+
'<?php
135+
class FooTest extends TestCase
136+
{
137+
public function testFoo()
138+
{
139+
$this->getMock("Foo",);
140+
$this->getMock("Bar" ,);
141+
$this->getMock("Baz" , );
142+
$this->getMock($foo(1, 2), );
143+
$this->getMock($foo(3, 4, ));
144+
$this->getMock($foo(5, 6, ), );
145+
$this->getMock("Foo", ["aaa"], );
146+
$this->getMock("Foo", ["bbb", ], );
147+
$this->getMock("Foo", ["aaa"], ["argument"], );
148+
$this->getMock("Foo", ["bbb", ], ["argument", ], );
149+
}
150+
}'
151+
);
152+
}
110153
}

tests/Fixtures/Integration/misc/PHP7_3.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ PHP 7.3 test.
1313
"native_function_invocation": {"include": ["get_class"]},
1414
"php_unit_dedicate_assert": true,
1515
"php_unit_expectation": true,
16+
"php_unit_mock": true,
1617
"php_unit_test_case_static_method_calls": {"call_type": "this"},
1718
"strict_param": true
1819
}
@@ -61,6 +62,7 @@ final class MyTest extends \PHPUnit_Framework_TestCase
6162
$this->expectException('RuntimeException');
6263
$this->expectExceptionMessage('Msg');
6364
$this->expectExceptionCode(123); // `php_unit_expectation` rule
65+
$this->createMock('Foo', ); // `php_unit_mock` rule
6466
$this->assertSame(1, 2, ); // `php_unit_test_case_static_method_calls` rule
6567
}
6668
}
@@ -111,6 +113,7 @@ final class MyTest extends \PHPUnit_Framework_TestCase
111113
public function testFoo(): void
112114
{
113115
$this->setExpectedException('RuntimeException', 'Msg', 123, ); // `php_unit_expectation` rule
116+
$this->getMock('Foo', ); // `php_unit_mock` rule
114117
static::assertSame(1, 2, ); // `php_unit_test_case_static_method_calls` rule
115118
}
116119
}

0 commit comments

Comments
 (0)