Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Feb 5, 2023
2 parents 772ba5f + f9d09b9 commit c682fc6
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@
<code>UnexsistenceClass</code>
</UndefinedClass>
</file>
<file src="tests/system/Config/BaseConfigTest.php">
<UndefinedClass occurrences="1">
<code>SimpleConfig</code>
</UndefinedClass>
</file>
<file src="tests/system/Config/FactoriesTest.php">
<UndefinedClass occurrences="1">
<code>'SomeWidget'</code>
Expand Down
3 changes: 3 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
use Rector\PHPUnit\Rector\MethodCall\AssertPropertyExistsRector;
use Rector\PHPUnit\Rector\MethodCall\GetMockBuilderGetMockToCreateMockRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
Expand Down Expand Up @@ -80,6 +81,8 @@
__DIR__ . '/tests/_support',
JsonThrowOnErrorRector::class,
StringifyStrNeedlesRector::class,
// assertObjectHasAttribute() is deprecated
AssertPropertyExistsRector::class,

RemoveUnusedPrivateMethodRector::class => [
// private method called via getPrivateMethodInvoker
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Commands/BaseCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public function testMagicIssetTrue()
{
$command = new AppInfo($this->logger, service('commands'));

$this->assertObjectHasAttribute('group', $command);
$this->assertTrue(isset($command->group));
}

public function testMagicIssetFalse()
{
$command = new AppInfo($this->logger, service('commands'));

$this->assertObjectNotHasAttribute('foobar', $command);
$this->assertFalse(isset($command->foobar));
}

public function testMagicGet()
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Config/BaseConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function testEnvironmentOverrides()
// override config with shortPrefix ENV var
$this->assertSame('hubbahubba', $config->delta);
// incorrect env name should not inject property
$this->assertObjectNotHasAttribute('notthere', $config);
$this->assertFalse(property_exists($config, 'notthere'));
// empty ENV var should not affect config setting
$this->assertSame('pineapple', $config->fruit);
// non-empty ENV var should overrideconfig setting
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Entity/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function testFill()

$this->assertSame(123, $entity->foo);
$this->assertSame('bar:234:bar', $entity->bar);
$this->assertObjectNotHasAttribute('baz', $entity);
$this->assertSame(4556, $entity->baz);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions tests/system/Log/Handlers/ChromeLoggerHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ public function testSetDateFormat()
$config->handlers['CodeIgniter\Log\Handlers\TestHandler']['handles'] = ['critical'];

$logger = new ChromeLoggerHandler($config->handlers['CodeIgniter\Log\Handlers\TestHandler']);

$result = $logger->setDateFormat('F j, Y');

$this->assertObjectHasAttribute('dateFormat', $result);
$this->assertObjectHasAttribute('dateFormat', $logger);
$this->assertSame('F j, Y', $this->getPrivateProperty($result, 'dateFormat'));
$this->assertSame('F j, Y', $this->getPrivateProperty($logger, 'dateFormat'));
}

public function testChromeLoggerHeaderSent()
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Test/FabricatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public function testCreateMockSetsDatabaseFields()
$this->assertIsInt($result->created_at);
$this->assertIsInt($result->updated_at);

$this->assertObjectHasAttribute('deleted_at', $result);
$this->assertTrue(property_exists($result, 'deleted_at'));
$this->assertNull($result->deleted_at);
}

Expand Down

0 comments on commit c682fc6

Please sign in to comment.