MappingValueConverterTest.php 657 B

123456789101112131415161718192021
  1. <?php
  2. namespace Ddeboer\DataImport\Tests\ValueConverter;
  3. use Ddeboer\DataImport\ValueConverter\MappingValueConverter;
  4. class MappingValueConverterTest extends \PHPUnit_Framework_TestCase
  5. {
  6. /**
  7. * @expectedException Ddeboer\DataImport\Exception\UnexpectedValueException
  8. * @expectedExceptionMessage Cannot find mapping for value "unexpected value"
  9. */
  10. public function testConvert()
  11. {
  12. $converter = new MappingValueConverter(array(
  13. 'source' => 'destination'
  14. ));
  15. $this->assertSame('destination', call_user_func($converter, 'source'));
  16. call_user_func($converter, 'unexpected value');
  17. }
  18. }