/** * @test * @dataProvider canConvertFromDataProvider */ public function canConvertFromTests($targetType, $expectedResult) { $actualResult = $this->converter->canConvertFrom(array(), $targetType); if ($expectedResult === true) { $this->assertTrue($actualResult); } else { $this->assertFalse($actualResult); } }
/** * @inheritdoc */ public function canConvertFrom($source, $targetType) { if (!$this->typedArrayConverter->canConvertFrom($source, $targetType)) { return false; } if (!is_array($source) || !array_key_exists('data', $source)) { return false; } foreach ($source['data'] as $data) { if (!$this->hasOnlyIdentifierProperties($data)) { return false; } } return true; }