Skip to content

Commit

Permalink
Added civicrm installer (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
clicktrend authored and niksamokhvalov committed Jan 18, 2018
1 parent 049797d commit 9279812
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ is not needed to install packages with these frameworks:
| Bitrix | `bitrix-module` (deprecated) <br>`bitrix-component` (deprecated) <br>`bitrix-theme` (deprecated) <br><br> `bitrix-d7-module` <br> `bitrix-d7-component` <br> `bitrix-d7-template`
| CakePHP 2+ | **`cakephp-plugin`**
| Chef | `chef-cookbook`<br>`chef-role`
| CiviCrm | `civicrm-ext`
| CCFramework | `ccframework-ship`<br>`ccframework-theme`
| Cockpit | `cockpit-module`
| CodeIgniter | `codeigniter-library`<br>`codeigniter-third-party`<br>`codeigniter-module`
Expand Down
9 changes: 9 additions & 0 deletions src/Composer/Installers/CiviCrmInstaller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
namespace Composer\Installers;

class CiviCrmInstaller extends BaseInstaller
{
protected $locations = array(
'ext' => 'ext/{$name}/'
);
}
1 change: 1 addition & 0 deletions src/Composer/Installers/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Installer extends LibraryInstaller
'bonefish' => 'BonefishInstaller',
'cakephp' => 'CakePHPInstaller',
'chef' => 'ChefInstaller',
'civicrm' => 'CiviCrmInstaller',
'ccframework' => 'ClanCatsFrameworkInstaller',
'cockpit' => 'CockpitInstaller',
'codeigniter' => 'CodeIgniterInstaller',
Expand Down
55 changes: 55 additions & 0 deletions tests/Composer/Installers/Test/CiviCrmInstallerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
namespace Composer\Installers\Test;

use Composer\Installers\CiviCrmInstaller;
use Composer\Package\Package;
use Composer\Composer;
use PHPUnit\Framework\TestCase as BaseTestCase;

class CiviCrmInstallerTest extends BaseTestCase
{
/**
* @var VgmcpInstaller
*/
private $installer;

public function setUp()
{
$this->installer = new CiviCrmInstaller(
new Package('NyanCat', '4.2', '4.2'),
new Composer()
);
}

/**
* @dataProvider packageNameInflectionProvider
*/
public function testInflectPackageVars($type, $name, $expected)
{
$this->assertEquals(
array('name' => $expected, 'type' => $type),
$this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
);
}

public function packageNameInflectionProvider()
{
return array(
array(
'civicrm-ext',
'org.civicrm.shoreditch',
'org.civicrm.shoreditch'
),
array(
'civicrm-ext',
'org.civicrm.flexmailer',
'org.civicrm.flexmailer'
),
array(
'civicrm-ext',
'uk.co.vedaconsulting.mosaico',
'uk.co.vedaconsulting.mosaico'
)
);
}
}

0 comments on commit 9279812

Please sign in to comment.