/** * @covers MarketMeSuite\Phranken\Util\ArrayUtils::structureExists */ public function testStructureExists() { $actual = ArrayUtils::structureExists(array('user' => array('access' => '1337')), array('user' => array('access' => ''))); $this->assertSame(true, $actual); $actual = ArrayUtils::structureExists(array('user' => array('access' => '1337', 'token' => '80081322')), array('user' => array('access' => ''))); $this->assertSame(true, $actual, 'does not care about extra strucure'); $actual = ArrayUtils::structureExists(array('user' => array('access' => '1337')), array('user' => array('access' => '', 'token' => ''))); $this->assertSame(false, $actual, 'missing structure is failure'); $actual = ArrayUtils::structureExists(array(), array()); $this->assertSame(true, $actual, 'empty arrays are the same schema'); $actual = ArrayUtils::structureExists(array('user' => array('access' => array('nope' => 'nope'))), array('user' => array('access' => ''))); $this->assertSame(true, $actual, 'does not care about deeper strucures'); }