eZ\Publish\Core\FieldType\Tests\FieldTypeTest::assertIsValidHashValue PHP Method

assertIsValidHashValue() protected method

Asserts that the given $actualHash complies to the rules for hashes.
protected assertIsValidHashValue ( mixed $actualHash, array $keyChain = [] )
$actualHash mixed
$keyChain array
    protected function assertIsValidHashValue($actualHash, $keyChain = array())
    {
        switch ($actualHashType = gettype($actualHash)) {
            case 'boolean':
            case 'integer':
            case 'double':
            case 'string':
            case 'NULL':
                // All valid, just return
                return;
            case 'array':
                foreach ($actualHash as $key => $childHash) {
                    $this->assertIsValidHashValue($childHash, array_merge($keyChain, array($key)));
                }
                return;
            case 'resource':
            case 'object':
                $this->fail(sprintf('Value for $hash[%s] is of invalid type "%s".', implode('][', $keyChain), $actualHashType));
        }
    }