Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
cleanPackage example
$package
=
$event
->
getOperation
(
)
->
getTargetPackage
(
)
;
$this
->
removeBinBeforeCleanup
(
$package
)
;
}
/** * POST_PACKAGE_INSTALL event handler. * * @param \Composer\Installer\PackageEvent $event * The package event. */
public
function
onPostPackageInstall
(
PackageEvent
$event
)
{
$this
->
cleanPackage
(
$event
->
getOperation
(
)
->
getPackage
(
)
)
;
}
/** * POST_PACKAGE_UPDATE event handler. * * @param \Composer\Installer\PackageEvent $event * The package event. */
public
function
onPostPackageUpdate
(
PackageEvent
$event
)
{
$this
->
cleanPackage
(
$event
->
getOperation
(
)
->
getTargetPackage
(
)
)
;
}
$ref_config
->
setValue
(
$plugin
,
$config
)
;
$io
=
$this
->
prophesize
(
IOInterface::
class
)
;
$ref_io
=
new
\
ReflectionProperty
(
$plugin
, 'io'
)
;
$ref_io
->
setValue
(
$plugin
,
$io
->
reveal
(
)
)
;
$this
->
assertFileExists
(
vfsStream::
url
(
'vendor/drupal/package/tests/SomeTest.php'
)
)
;
$package
=
$this
->
prophesize
(
PackageInterface::
class
)
;
$package
->
getName
(
)
->
willReturn
(
'drupal/package'
)
;
$plugin
->
cleanPackage
(
$package
->
reveal
(
)
)
;
$this
->
assertFileDoesNotExist
(
vfsStream::
url
(
'vendor/drupal/package/tests'
)
)
;
}
/** * @covers ::cleanPathsForPackage */
public
function
testCleanPathsForPackage
(
)
{
$plugin
=
$this
->
getMockBuilder
(
VendorHardeningPlugin::
class
)
->
onlyMethods
(
[
'getInstallPathForPackage'
]
)
->
getMock
(
)
;