mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
test: replace deprecated assertObjectHasAttribute()
This commit is contained in:
parent
f7ab73667a
commit
8461519e58
@ -35,14 +35,14 @@ final class BaseCommandTest extends CIUnitTestCase
|
||||
{
|
||||
$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()
|
||||
|
@ -110,7 +110,7 @@ final class BaseConfigTest extends CIUnitTestCase
|
||||
// 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
|
||||
|
@ -96,7 +96,7 @@ final class EntityTest extends CIUnitTestCase
|
||||
|
||||
$this->assertSame(123, $entity->foo);
|
||||
$this->assertSame('bar:234:bar', $entity->bar);
|
||||
$this->assertObjectNotHasAttribute('baz', $entity);
|
||||
$this->assertSame(4556, $entity->baz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,10 +66,11 @@ final class ChromeLoggerHandlerTest extends CIUnitTestCase
|
||||
$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()
|
||||
|
@ -406,7 +406,7 @@ final class FabricatorTest extends CIUnitTestCase
|
||||
$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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user