Skip to content

Commit

Permalink
PhpUnitMockFixer - add tests for PHP 7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Jan 3, 2019
1 parent 4537bfd commit 7d2e747
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/Fixer/PhpUnit/PhpUnitMockFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,47 @@ public function testFoo()
],
];
}

/**
* @requires PHP 7.3
*/
public function testFix73()
{
$this->doTest(
'<?php
class FooTest extends TestCase
{
public function testFoo()
{
$this->createMock("Foo",);
$this->createMock("Bar" ,);
$this->createMock("Baz" , );
$this->createMock($foo(1, 2), );
$this->createMock($foo(3, 4, ));
$this->createMock($foo(5, 6, ), );
$this->createPartialMock("Foo", ["aaa"], );
$this->createPartialMock("Foo", ["bbb", ], );
$this->getMock("Foo", ["aaa"], ["argument"], );
$this->getMock("Foo", ["bbb", ], ["argument", ], );
}
}',
'<?php
class FooTest extends TestCase
{
public function testFoo()
{
$this->getMock("Foo",);
$this->getMock("Bar" ,);
$this->getMock("Baz" , );
$this->getMock($foo(1, 2), );
$this->getMock($foo(3, 4, ));
$this->getMock($foo(5, 6, ), );
$this->getMock("Foo", ["aaa"], );
$this->getMock("Foo", ["bbb", ], );
$this->getMock("Foo", ["aaa"], ["argument"], );
$this->getMock("Foo", ["bbb", ], ["argument", ], );
}
}'
);
}
}
3 changes: 3 additions & 0 deletions tests/Fixtures/Integration/misc/PHP7_3.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ PHP 7.3 test.
"mb_str_functions": true,
"multiline_whitespace_before_semicolons": true,
"native_function_invocation": {"include": ["get_class"]},
"php_unit_mock": true,
"php_unit_test_case_static_method_calls": {"call_type": "this"},
"strict_param": true
}
Expand Down Expand Up @@ -52,6 +53,7 @@ final class MyTest extends \PHPUnit_Framework_TestCase
{
public function testFoo(): void
{
$this->createMock('Foo', ); // `php_unit_mock` rule
$this->assertSame(1, 2, ); // `php_unit_test_case_static_method_calls` rule
}
}
Expand Down Expand Up @@ -98,6 +100,7 @@ final class MyTest extends \PHPUnit_Framework_TestCase
{
public function testFoo(): void
{
$this->getMock('Foo', ); // `php_unit_mock` rule
static::assertSame(1, 2, ); // `php_unit_test_case_static_method_calls` rule
}
}
Expand Down

0 comments on commit 7d2e747

Please sign in to comment.