-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PHPUnit 10] Rename assertObjectHasAttribute() to assertObjectHasProperty(), add AssertIssetToAssertObjectHasPropertyRector #338
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
29d397f
add phpunit 11.0 set
TomasVotruba 00cac2e
remove deprecated-level-set with no link
TomasVotruba c515342
Remove PropertyExistsWithoutAssertRector and replace with simple rename
TomasVotruba f0d26e4
make AssertIssetToSpecificMethodRector skip properties, as handled in…
TomasVotruba a25c56d
[PHPUnit 10] Add AssertIssetToAssertObjectHasPropertyRector
TomasVotruba 6557da6
skip magic isset
TomasVotruba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Rector\PHPUnit\PHPUnit110\Rector\Class_\NamedArgumentForDataProviderRector; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->rules([NamedArgumentForDataProviderRector::class]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
.../MethodCall/AssertIssetToSpecificMethodRector/Fixture/magic_method_set_is_ignored.php.inc
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...rtIssetToSpecificMethodRector/Fixture/skip_if_magic_method_isset_exists_in_parent.php.inc
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...Quality/Rector/MethodCall/AssertIssetToSpecificMethodRector/Fixture/skip_property.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\AssertIssetToSpecificMethodRector\Fixture; | ||
|
||
final class SkipProperty extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function test() | ||
{ | ||
$this->assertTrue(isset($node->value1)); | ||
$this->assertFalse(isset($node->value2), 'message'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
...skip_if_magic_method_isset_exists.php.inc → ...tyRector/Fixture/skip_magic_isset.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
<?php | ||
|
||
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\AssertIssetToSpecificMethodRector\Fixture; | ||
namespace Rector\PHPUnit\Tests\PHPUnit100\Rector\MethodCall\AssertIssetToAssertObjectHasPropertyRector\Fixture; | ||
|
||
final class CustomIsset { | ||
final class CustomIsset | ||
{ | ||
public function __isset($property) { | ||
return false; | ||
} | ||
} | ||
|
||
final class SkipCustomIsset extends \PHPUnit\Framework\TestCase | ||
final class SkipMagicIsset extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function test() | ||
{ | ||
$foo = new CustomIsset(); | ||
$this->assertTrue(isset($foo->bar)); | ||
} | ||
} | ||
|
||
?> |
33 changes: 33 additions & 0 deletions
33
...hodCall/AssertIssetToAssertObjectHasPropertyRector/Fixture/some_isset_to_property.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Rector\PHPUnit\Tests\PHPUnit100\Rector\MethodCall\AssertIssetToAssertObjectHasPropertyRector\Fixture; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
final class SomeIssetToProperty extends TestCase | ||
{ | ||
public function test() | ||
{ | ||
$object = new \stdClass(); | ||
$this->assertTrue(isset($object->someProperty)); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\PHPUnit\Tests\PHPUnit100\Rector\MethodCall\AssertIssetToAssertObjectHasPropertyRector\Fixture; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
final class SomeIssetToProperty extends TestCase | ||
{ | ||
public function test() | ||
{ | ||
$object = new \stdClass(); | ||
$this->assertObjectHasAttribute('someProperty', $object); | ||
} | ||
} | ||
|
||
?> |
9 changes: 9 additions & 0 deletions
9
...0/Rector/MethodCall/AssertIssetToAssertObjectHasPropertyRector/config/configured_rule.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Rector\PHPUnit\PHPUnit100\Rector\MethodCall\AssertIssetToAssertObjectHasPropertyRector; | ||
|
||
return RectorConfig::configure() | ||
->withRules([AssertIssetToAssertObjectHasPropertyRector::class]); |
33 changes: 0 additions & 33 deletions
33
...ts/PHPUnit100/Rector/MethodCall/PropertyExistsWithoutAssertRector/Fixture/fixture.php.inc
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
...s/PHPUnit100/Rector/MethodCall/PropertyExistsWithoutAssertRector/Fixture/fixture2.php.inc
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
...s/PHPUnit100/Rector/MethodCall/PropertyExistsWithoutAssertRector/Fixture/fixture3.php.inc
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the method seems should be
assertObjectNotHasProperty
, see https://github.com/sebastianbergmann/phpunit/blob/bb24b2746512bc8be5122bb220064df8f8687451/src/Framework/Assert.php#L1052C34-L1052C60There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#340