The key is not added to the package because it would show up in the
composer.lock file in this case. A custom file system is used to
swap out the ACF PRO url with a url that contains the key.
public addKey ( Composer\Plugin\PreFileDownloadEvent $event ) | ||
$event | Composer\Plugin\PreFileDownloadEvent | The event that called this method |
public function testOnlyAddKeyOnAcfUrl() { // Make key available in the ENVIRONMENT putenv(self::KEY_ENV_VARIABLE . '=KEY'); // Mock an Event $event = $this->getMockBuilder('Composer\\Plugin\\PreFileDownloadEvent')->disableOriginalConstructor()->setMethods(['getProcessedUrl', 'getRemoteFilesystem', 'setRemoteFilesystem'])->getMock(); $event->expects($this->once())->method('getProcessedUrl')->willReturn('another-url'); $event->expects($this->never())->method('getRemoteFilesystem'); $event->expects($this->never())->method('setRemoteFilesystem'); // Call addKey $plugin = new Plugin(); $plugin->addKey($event); }