-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #327 from totten/master-facade-2
(REF) Convert "Upgrader" to "Generator"
- Loading branch information
Showing
21 changed files
with
124 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
namespace CRM\CivixBundle; | ||
|
||
use PHPUnit\Framework\Test; | ||
|
||
class CivixTestListener implements \PHPUnit\Framework\TestListener { | ||
use \PHPUnit\Framework\TestListenerDefaultImplementation; | ||
|
||
public function startTest(Test $test): void { | ||
\Civix::reset(); | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -42,13 +42,13 @@ protected function execute(InputInterface $input, OutputInterface $output) { | |
// Boot CiviCRM to use api4 | ||
Civix::boot(['output' => $output]); | ||
|
||
$upgrader = $this->getUpgrader(); | ||
$upgrader->addMixins(['[email protected]']); | ||
$gen = \Civix::generator(); | ||
$gen->addMixins(['[email protected]']); | ||
if ($entityName === 'Afform') { | ||
$upgrader->exportAfform($entityId); | ||
$gen->exportAfform($entityId); | ||
} | ||
else { | ||
$upgrader->exportMgd($entityName, $entityId); | ||
$gen->exportMgd($entityName, $entityId); | ||
} | ||
|
||
return 0; | ||
|
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 |
---|---|---|
|
@@ -23,20 +23,20 @@ protected function configure() { | |
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) { | ||
$up = $this->getUpgrader(); | ||
$up->addMixins(['[email protected]']); | ||
$gen = \Civix::generator(); | ||
$gen->addMixins(['[email protected]']); | ||
|
||
$servicePrefix = $up->infoXml->getFile(); | ||
$namespace = Naming::coerceNamespace($up->infoXml->getNamespace(), $input->getOption('naming')); | ||
$servicePrefix = $gen->infoXml->getFile(); | ||
$namespace = Naming::coerceNamespace($gen->infoXml->getNamespace(), $input->getOption('naming')); | ||
|
||
if ($input->isInteractive()) { | ||
$defaultName = $input->getArgument('name') ?? Naming::createServiceName($servicePrefix, 'myService'); | ||
$this->getIO()->note([ | ||
Civix::io()->note([ | ||
'The service name is a short machine name. It may appear in contexts like:', | ||
sprintf('Civi::service("%s")->doSomething()', $defaultName), | ||
sprintf('It is recommended to always have a naming prefix (such as "%s").', $servicePrefix), | ||
]); | ||
$serviceName = $this->getIO()->ask('Service name', $defaultName, function ($answer) { | ||
$serviceName = Civix::io()->ask('Service name', $defaultName, function ($answer) { | ||
if ('' === trim($answer)) { | ||
throw new \Exception('Service name cannot be empty'); | ||
} | ||
|
@@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { | |
$baseNameParts = array_map('ucfirst', explode('.', $baseName)); | ||
$className = Naming::createClassName($namespace, ...$baseNameParts); | ||
|
||
$up->addClass($className, 'service.php.php', [ | ||
$gen->addClass($className, 'service.php.php', [ | ||
'service' => $serviceName, | ||
]); | ||
} | ||
|
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
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
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
Oops, something went wrong.