public function testTransform() { $entity = $this->getMock('Oro\\Bundle\\TagBundle\\Entity\\Taggable'); $this->transformer->setEntity($entity); $resultArray = array(array('some key' => 'some value')); $phpUnit = $this; $this->manager->expects($this->once())->method('getPreparedArray')->will($this->returnCallback(function ($entityArg, $tagsArg) use($phpUnit, $entity, $resultArray) { $phpUnit->assertEquals($entity, $entityArg); $phpUnit->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $tagsArg); return $resultArray; }))->will($this->returnValue($resultArray)); $this->assertEquals($this->transformer->transform(array()), json_encode($resultArray)); }
/** * @dataProvider valueTransformProvider * * @param $expected * @param $value */ public function testTransform($expected, $value) { $this->assertEquals($expected, $this->transformer->transform($value)); }