for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nip\Config\Tests;
use Nip\Config\Config;
/**
* Class ApplicationTest
*/
class ConfigTest extends AbstractTest
{
* @var Config
protected $config;
public function setUp()
parent::setUp();
$this->config = new Config();
}
public function testMergeFile()
static::assertInstanceOf(Config::class, $this->config);
static::assertEquals([], $this->config->toArray());
$this->config->mergeFile(TEST_FIXTURE_PATH.'/general.ini');
static::assertCount(6, $this->config->toArray());
$this->config->toArray()
array
object<Countable>|object...nit\Framework\iterable>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
static::assertInstanceOf(Config::class, $this->config->get('SITE'));
static::assertTrue($this->config->has('META'));
static::assertTrue($this->config->has('META.title'));
static::assertEquals('My Site', $this->config->get('META')->get('title'));
static::assertEquals('My Site', $this->config->get('META.title'));
static::assertFalse($this->config->has('META.title1'));
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: