| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* @file |
| 5 |
* Tests event dispatching. |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace cweagans\Composer\Tests; |
| 9 |
|
| 10 |
use cweagans\Composer\PatchEvent; |
| 11 |
use cweagans\Composer\PatchEvents; |
| 12 |
use Composer\Package\PackageInterface; |
| 13 |
|
| 14 |
class PatchEventTest extends \PHPUnit_Framework_TestCase { |
| 15 |
|
| 16 |
/** |
| 17 |
* Tests all the getters. |
| 18 |
* |
| 19 |
* @dataProvider patchEventDataProvider |
| 20 |
*/ |
| 21 |
public function testGetters($event_name, PackageInterface $package, $url, $description) { |
| 22 |
$patch_event = new PatchEvent($event_name, $package, $url, $description); |
| 23 |
$this->assertEquals($event_name, $patch_event->getName()); |
| 24 |
$this->assertEquals($package, $patch_event->getPackage()); |
| 25 |
$this->assertEquals($url, $patch_event->getUrl()); |
| 26 |
$this->assertEquals($description, $patch_event->getDescription()); |
| 27 |
} |
| 28 |
|
| 29 |
public function patchEventDataProvider() { |
| 30 |
$prophecy = $this->prophesize('Composer\Package\PackageInterface'); |
| 31 |
$package = $prophecy->reveal(); |
| 32 |
|
| 33 |
return array( |
| 34 |
array(PatchEvents::PRE_PATCH_APPLY, $package, 'https://www.drupal.org', 'A test patch'), |
| 35 |
array(PatchEvents::POST_PATCH_APPLY, $package, 'https://www.drupal.org', 'A test patch'), |
| 36 |
); |
| 37 |
} |
| 38 |
|
| 39 |
} |
| 40 |
|