Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/sets/composer-based.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Rector\PHPUnit\PHPUnit100\Rector\Class_\ParentTestClassConstructorRector;
use Rector\PHPUnit\PHPUnit100\Rector\Class_\PublicDataProviderClassMethodRector;
use Rector\PHPUnit\PHPUnit100\Rector\Class_\StaticDataProviderClassMethodRector;
use Rector\PHPUnit\PHPUnit100\Rector\MethodCall\PropertyExistsWithoutAssertRector;
use Rector\PHPUnit\PHPUnit100\Rector\MethodCall\RemoveSetMethodsMethodCallRector;
use Rector\PHPUnit\PHPUnit100\Rector\StmtsAwareInterface\WithConsecutiveRector;
use Rector\PHPUnit\PHPUnit110\Rector\CallLike\AssertContainsOnlyMethodCallRector;
Expand Down Expand Up @@ -148,6 +149,7 @@
AddProphecyTraitRector::class,
WithConsecutiveRector::class,
RemoveSetMethodsMethodCallRector::class,
PropertyExistsWithoutAssertRector::class,
ParentTestClassConstructorRector::class,

// PHPUnit 11.0
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Rector\PHPUnit\Tests\PHPUnit100\Rector\MethodCall\PropertyExistsWithoutAssertRector\Fixture;

use PHPUnit\Framework\TestCase;

final class SkipAssertObjectHasAttribute extends TestCase
{
public function test(object $someObject)
{
// has a direct replacement in assertObjectHasProperty(), renamed by the composer-based set
$this->assertObjectHasAttribute('property', $someObject);
$this->assertObjectNotHasAttribute('property', $someObject);
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ public function provideComposerPackageConstraint(): ComposerPackageConstraint
}

/**
* The assertObjectHasAttribute() and assertObjectNotHasAttribute() methods are left out on purpose,
* as they have a direct replacement in assertObjectHasProperty() and assertObjectNotHasProperty().
* Those renames are handled by RenameMethodRector in the composer-based set.
*
* @var array<string, string>
*/
private const array RENAME_METHODS_WITH_OBJECT_MAP = [
'assertClassHasAttribute' => 'assertTrue',
'assertObjectHasAttribute' => 'assertTrue',
'assertClassHasStaticAttribute' => 'assertTrue',
// false
'assertClassNotHasStaticAttribute' => 'assertFalse',
'assertClassNotHasAttribute' => 'assertFalse',
'assertObjectNotHasAttribute' => 'assertFalse',
// no assert
'objectHasAttribute' => 'assertTrue',
'classHasAttribute' => 'assertTrue',
Expand Down
Loading