Skip to content

Commit 8461519

Browse files
committed
test: replace deprecated assertObjectHasAttribute()
1 parent f7ab736 commit 8461519

5 files changed

Lines changed: 8 additions & 7 deletions

File tree

tests/system/Commands/BaseCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public function testMagicIssetTrue()
3535
{
3636
$command = new AppInfo($this->logger, service('commands'));
3737

38-
$this->assertObjectHasAttribute('group', $command);
38+
$this->assertTrue(isset($command->group));
3939
}
4040

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

45-
$this->assertObjectNotHasAttribute('foobar', $command);
45+
$this->assertFalse(isset($command->foobar));
4646
}
4747

4848
public function testMagicGet()

tests/system/Config/BaseConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function testEnvironmentOverrides()
110110
// override config with shortPrefix ENV var
111111
$this->assertSame('hubbahubba', $config->delta);
112112
// incorrect env name should not inject property
113-
$this->assertObjectNotHasAttribute('notthere', $config);
113+
$this->assertFalse(property_exists($config, 'notthere'));
114114
// empty ENV var should not affect config setting
115115
$this->assertSame('pineapple', $config->fruit);
116116
// non-empty ENV var should overrideconfig setting

tests/system/Entity/EntityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function testFill()
9696

9797
$this->assertSame(123, $entity->foo);
9898
$this->assertSame('bar:234:bar', $entity->bar);
99-
$this->assertObjectNotHasAttribute('baz', $entity);
99+
$this->assertSame(4556, $entity->baz);
100100
}
101101

102102
/**

tests/system/Log/Handlers/ChromeLoggerHandlerTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ public function testSetDateFormat()
6666
$config->handlers['CodeIgniter\Log\Handlers\TestHandler']['handles'] = ['critical'];
6767

6868
$logger = new ChromeLoggerHandler($config->handlers['CodeIgniter\Log\Handlers\TestHandler']);
69+
6970
$result = $logger->setDateFormat('F j, Y');
7071

71-
$this->assertObjectHasAttribute('dateFormat', $result);
72-
$this->assertObjectHasAttribute('dateFormat', $logger);
72+
$this->assertSame('F j, Y', $this->getPrivateProperty($result, 'dateFormat'));
73+
$this->assertSame('F j, Y', $this->getPrivateProperty($logger, 'dateFormat'));
7374
}
7475

7576
public function testChromeLoggerHeaderSent()

tests/system/Test/FabricatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ public function testCreateMockSetsDatabaseFields()
406406
$this->assertIsInt($result->created_at);
407407
$this->assertIsInt($result->updated_at);
408408

409-
$this->assertObjectHasAttribute('deleted_at', $result);
409+
$this->assertTrue(property_exists($result, 'deleted_at'));
410410
$this->assertNull($result->deleted_at);
411411
}
412412

0 commit comments

Comments
 (0)