4 * This file is part of the Fxp Composer Asset Plugin package.
6 * (c) François Pluchino <francois.pluchino@gmail.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Fxp\Composer\AssetPlugin\Tests\Converter;
14 use Fxp\Composer\AssetPlugin\Converter\PackageConverterInterface;
15 use Fxp\Composer\AssetPlugin\Tests\Fixtures\Converter\InvalidPackageConverter;
16 use Fxp\Composer\AssetPlugin\Type\AssetTypeInterface;
19 * Abstract tests of asset package converter.
21 * @author François Pluchino <francois.pluchino@gmail.com>
23 abstract class AbstractPackageConverterTest extends \PHPUnit_Framework_TestCase
26 * @var AssetTypeInterface
31 * @var PackageConverterInterface
40 protected function setUp()
42 $versionConverter = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Converter\VersionConverterInterface')->getMock();
43 $versionConverter->expects($this->any())
44 ->method('convertVersion')
45 ->will($this->returnCallback(function ($value) {
48 $versionConverter->expects($this->any())
49 ->method('convertRange')
50 ->will($this->returnCallback(function ($value) {
53 $type = $this->getMockBuilder('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface')->getMock();
54 $type->expects($this->any())
55 ->method('getComposerVendorName')
56 ->will($this->returnValue('ASSET'));
57 $type->expects($this->any())
58 ->method('getComposerType')
59 ->will($this->returnValue('ASSET_TYPE'));
60 $type->expects($this->any())
61 ->method('getVersionConverter')
62 ->will($this->returnValue($versionConverter));
63 $type->expects($this->any())
64 ->method('formatComposerName')
65 ->will($this->returnCallback(function ($value) {
66 return 'ASSET/'.$value;
72 protected function tearDown()
75 $this->converter = null;
76 $this->asset = array();
80 * @expectedException \Fxp\Composer\AssetPlugin\Exception\InvalidArgumentException
82 public function testConversionWithInvalidKey()
84 $this->converter = new InvalidPackageConverter($this->type);
86 $this->converter->convert(array(