22
33namespace IonBazan \ComposerDiff \Tests \Url ;
44
5+ use Composer \Package \CompletePackageInterface ;
6+ use Composer \Package \PackageInterface ;
57use IonBazan \ComposerDiff \Url \DrupalGenerator ;
68
79class DrupalGeneratorTest extends GeneratorTest
@@ -17,6 +19,10 @@ public function releaseUrlProvider()
1719 $ this ->getPackageWithSource ('drupal/webform ' , '6.0.0 ' , 'https://git.drupalcode.org/project/webform.git ' , '6.0.0 ' ),
1820 'https://www.drupal.org/project/webform/releases/6.0.0 ' ,
1921 ),
22+ 'semver-semver-dist ' => array (
23+ $ this ->getPackageWithSourceAndDist ('drupal/webform ' , '6.0.0 ' , '6.0.0 ' , 'https://git.drupalcode.org/project/webform.git ' ),
24+ 'https://www.drupal.org/project/webform/releases/6.0.0 ' ,
25+ ),
2026 'core ' => array (
2127 $ this ->getPackageWithSource ('drupal/core ' , '9.0.0 ' , 'https://github.com/drupal/core.git ' , '9.0.0 ' ),
2228 'https://www.drupal.org/project/drupal/releases/9.0.0 ' ,
@@ -70,7 +76,12 @@ public function compareUrlProvider()
7076 $ this ->getPackageWithSourceAndDist ('drupal/color_field ' , '2.4.0 ' , '8.x-2.4 ' , 'https://git.drupalcode.org/project/color_field.git ' ),
7177 $ this ->getPackageWithSourceAndDist ('drupal/color_field ' , '2.5.0 ' , '8.x-2.5 ' , 'https://git.drupalcode.org/project/color_field.git ' ),
7278 'https://git.drupalcode.org/project/color_field/compare/8.x-2.4...8.x-2.5 ' ,
73- ),
79+ ),
80+ 'dev-version ' => array (
81+ $ this ->getPackageWithSourceAndDist ('drupal/color_field ' , '2.4.0 ' , '8.x-2.4 ' , 'https://git.drupalcode.org/project/color_field.git ' ),
82+ $ this ->getPackageWithSourceAndDist ('drupal/color_field ' , 'dev-2.5.0 ' , '8.x-2.5 ' , 'https://git.drupalcode.org/project/color_field.git ' , 'd46283075d76ed244f7825b378eeb1cee246af73 ' ),
83+ 'https://git.drupalcode.org/project/color_field/compare/8.x-2.4...d462830 ' ,
84+ ),
7485 );
7586 }
7687
@@ -80,13 +91,13 @@ public function compareUrlProvider()
8091 * @param string|null $sourceUrl
8192 * @param string|null $sourceReference
8293 *
83- * @return mixed
94+ * @return PackageInterface
8495 */
85- protected function getPackageWithSourceAndDist ($ name , $ version , $ dist_version , $ sourceUrl , $ sourceReference = null )
96+ protected function getPackageWithSourceAndDist ($ name , $ version , $ distVersion , $ sourceUrl , $ sourceReference = null )
8697 {
8798 $ package = $ this ->getPackage ($ name , $ version , $ sourceReference );
8899 $ package ->method ('getSourceUrl ' )->willReturn ($ sourceUrl );
89- $ package ->method ('getDistReference ' )->willReturn ($ dist_version );
100+ $ package ->method ('getDistReference ' )->willReturn ($ distVersion );
90101 $ package ->method ('getSourceReference ' )->willReturn ($ sourceReference );
91102 $ package ->method ('isDev ' )->willReturn (0 === strpos ($ version , 'dev- ' ) || '-dev ' === substr ($ version , -4 ));
92103
0 commit comments