Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Docker for Drupal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Composer
plugin
Docker for Drupal
Commits
d7836196
There was a problem fetching the pipeline summary.
Commit
d7836196
authored
7 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused tests
parent
1e4a010f
No related branches found
Branches containing commit
Tags
v1.1.1
Tags containing commit
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
phpunit.xml.dist
+0
-15
0 additions, 15 deletions
phpunit.xml.dist
tests/PluginTest.php
+0
-171
0 additions, 171 deletions
tests/PluginTest.php
with
0 additions
and
186 deletions
phpunit.xml.dist
deleted
100644 → 0
+
0
−
15
View file @
1e4a010f
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals=
"false"
colors=
"true"
bootstrap=
"vendor/autoload.php"
verbose=
"true"
>
<testsuites>
<testsuite
name=
"docker4drupal"
>
<directory>
./tests/
</directory>
</testsuite>
</testsuites>
</phpunit>
This diff is collapsed.
Click to expand it.
tests/PluginTest.php
deleted
100644 → 0
+
0
−
171
View file @
1e4a010f
<?php
/**
* @file
* Contains \LakeDrops\Docker4Drupal\Tests\PluginTest.
*/
namespace
LakeDrops\Docker4Drupal\Tests
;
use
Composer\Util\Filesystem
;
/**
* Tests composer plugin functionality.
*/
class
PluginTest
extends
\PHPUnit_Framework_TestCase
{
static
$name
=
'docker4drupal'
;
/**
* @var \Composer\Util\Filesystem
*/
protected
$fs
;
/**
* @var string
*/
protected
$tmpDir
;
/**
* @var string
*/
protected
$rootDir
;
/**
* @var string
*/
protected
$tmpReleaseTag
;
/**
* SetUp test
*/
public
function
setUp
()
{
$this
->
rootDir
=
realpath
(
realpath
(
__DIR__
.
'/..'
));
// Prepare temp directory.
$this
->
fs
=
new
Filesystem
();
$this
->
tmpDir
=
realpath
(
sys_get_temp_dir
())
.
DIRECTORY_SEPARATOR
.
self
::
$name
;
$this
->
ensureDirectoryExistsAndClear
(
$this
->
tmpDir
);
$this
->
writeTestReleaseTag
();
$this
->
writeComposerJSON
();
chdir
(
$this
->
tmpDir
);
}
/**
* tearDown
*
* @return void
*/
public
function
tearDown
()
{
$this
->
fs
->
removeDirectory
(
$this
->
tmpDir
);
$this
->
git
(
sprintf
(
'tag -d "%s"'
,
$this
->
tmpReleaseTag
));
}
/**
* Tests a simple composer install without core, but adding core later.
*/
public
function
testComposerInstallAndUpdate
()
{
# TODO: Write the actual tests
}
/**
* Writes the default composer json to the temp direcoty.
*/
protected
function
writeComposerJSON
()
{
$json
=
json_encode
(
$this
->
composerJSONDefaults
(),
JSON_PRETTY_PRINT
);
file_put_contents
(
$this
->
tmpDir
.
'/composer.json'
,
$json
);
}
/**
* Writes a tag for the current commit, so we can reference it directly in the
* composer.json.
*/
protected
function
writeTestReleaseTag
()
{
$this
->
tmpReleaseTag
=
'999.0.'
.
time
();
$this
->
git
(
sprintf
(
'tag -a "%s" -m "%s"'
,
$this
->
tmpReleaseTag
,
'Tag for testing this exact commit'
));
}
/**
* Provides the default composer.json data.
*
* @return array
*/
protected
function
composerJSONDefaults
()
{
return
array
(
'repositories'
=>
array
(
array
(
'type'
=>
'vcs'
,
'url'
=>
$this
->
rootDir
,
),
array
(
'type'
=>
'composer'
,
'url'
=>
'https://packages.drupal.org/8'
,
),
),
'require'
=>
array
(
'lakedrops/'
.
self
::
$name
=>
$this
->
tmpReleaseTag
,
'composer/installers'
=>
'~1.2.0'
,
'drupal/core'
=>
'~8.2.0'
,
'drupal-composer/drupal-scaffold'
=>
'~2.2.0'
,
),
'scripts'
=>
array
(
self
::
$name
=>
'LakeDrops\\Drupal8Scaffold\\Plugin::configProject'
,
),
'minimum-stability'
=>
'dev'
,
'extra'
=>
array
(
'installer-paths'
=>
array
(
'web/core'
=>
array
(
'type:drupal-core'
),
'web/modules/contrib/{$name}'
=>
array
(
'type:drupal-module'
),
'web/profiles/contrib/{$name}'
=>
array
(
'type:drupal-profile'
),
'web/themes/contrib/{$name}'
=>
array
(
'type:drupal-theme'
),
'drush/contrib/{$name}'
=>
array
(
'type:drupal-drush'
),
),
)
);
}
/**
* Wrapper for the composer command.
*
* @param string $command
* Composer command name, arguments and/or options
* @throws \Exception
*/
protected
function
composer
(
$command
)
{
chdir
(
$this
->
tmpDir
);
passthru
(
escapeshellcmd
(
$this
->
rootDir
.
'/vendor/bin/composer '
.
$command
),
$exit_code
);
if
(
$exit_code
!==
0
)
{
throw
new
\Exception
(
'Composer returned a non-zero exit code'
);
}
}
/**
* Wrapper for git command in the root directory.
*
* @param $command
* Git command name, arguments and/or options.
* @throws \Exception
*/
protected
function
git
(
$command
)
{
chdir
(
$this
->
rootDir
);
passthru
(
escapeshellcmd
(
'git -c "user.email=phpunit@test.com" '
.
$command
),
$exit_code
);
if
(
$exit_code
!==
0
)
{
throw
new
\Exception
(
'Git returned a non-zero exit code'
);
}
}
/**
* Makes sure the given directory exists and has no content.
*
* @param string $directory
*/
protected
function
ensureDirectoryExistsAndClear
(
$directory
)
{
if
(
is_dir
(
$directory
))
{
$this
->
fs
->
removeDirectory
(
$directory
);
}
mkdir
(
$directory
,
0777
,
TRUE
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment