-
-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update MauticInstaller to allow plugins & themes (#484)
* Update MauticInstaller to allow plugins & themes with custom directory names Update MauticInstaller to allow plugins & themes with custom directory names - Please do not merge yet * Update MauticInstaller.php * Update README.md * Update MauticInstaller.php * Adding mautic composer installer tests * Fixing tests and making it compatible with PHP 5.3
- Loading branch information
1 parent
0f4a400
commit 844fcbc
Showing
3 changed files
with
146 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
namespace Composer\Installers\Test; | ||
|
||
use Composer\Installers\MauticInstaller; | ||
use Composer\Package\Package; | ||
use Composer\Composer; | ||
|
||
class MauticInstallerTest extends TestCase | ||
{ | ||
/** | ||
* @var MauticInstaller | ||
*/ | ||
private $installer; | ||
|
||
/** | ||
* @var \Composer\Composer | ||
*/ | ||
protected $composer; | ||
|
||
public function setUp() | ||
{ | ||
$this->composer = new Composer(); | ||
} | ||
|
||
/** | ||
* @param string[] $vars | ||
* @param string[] $expectedVars | ||
* | ||
* @covers ::inflectPackageVars | ||
* | ||
* @dataProvider provideExpectedInflectionResults | ||
*/ | ||
final public function testInflectPackageVars($vars, $expectedVars) | ||
{ | ||
$package = new Package($vars['name'], '1.0.0', '1.0.0'); | ||
$package->setType($vars['type']); | ||
if (isset($vars['extra'])) { | ||
$package->setExtra((array) $vars['extra']); | ||
} | ||
|
||
$installer = new MauticInstaller( | ||
$package, | ||
$this->composer | ||
); | ||
|
||
$actual = $installer->inflectPackageVars($vars); | ||
$this->assertEquals($actual, $expectedVars); | ||
} | ||
|
||
/** | ||
* Provides various parameters for packages and the expected result after | ||
* inflection | ||
* | ||
* @return array | ||
*/ | ||
final public function provideExpectedInflectionResults() | ||
{ | ||
return array( | ||
//check bitrix-dir is correct | ||
array( | ||
array( | ||
'name' => 'mautic/grapes-js-builder-bundle', | ||
'type' => 'mautic-plugin' | ||
), | ||
array( | ||
'name' => 'GrapesJsBuilderBundle', | ||
'type' => 'mautic-plugin' | ||
) | ||
), | ||
// Check if composer renames the name based on the given | ||
// installation directory | ||
array( | ||
array( | ||
'name' => 'mautic/grapes-js-builder-bundle', | ||
'type' => 'mautic-plugin', | ||
'extra' => array( | ||
'install-directory-name' => 'GrapesJsBuilderPlugin' | ||
) | ||
), | ||
array( | ||
'name' => 'GrapesJsBuilderPlugin', | ||
'type' => 'mautic-plugin', | ||
'extra' => array( | ||
'install-directory-name' => 'GrapesJsBuilderPlugin' | ||
) | ||
) | ||
), | ||
array( | ||
array( | ||
'name' => 'mautic/theme-blank-grapejs', | ||
'type' => 'mautic-theme' | ||
), | ||
array( | ||
'name' => 'ThemeBlankGrapejs', | ||
'type' => 'mautic-theme' | ||
) | ||
), | ||
array( | ||
array( | ||
'name' => 'mautic/theme-blank-grapejs', | ||
'type' => 'mautic-theme', | ||
'extra' => array( | ||
'install-directory-name' => 'blank-grapejs' | ||
) | ||
), | ||
array( | ||
'name' => 'blank-grapejs', | ||
'type' => 'mautic-theme', | ||
'extra' => array( | ||
'install-directory-name' => 'blank-grapejs' | ||
) | ||
) | ||
) | ||
); | ||
} | ||
} |