Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UTMaltor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Extensions
UTMaltor
Commits
35a987c2
Commit
35a987c2
authored
7 years ago
by
scardinius
Browse files
Options
Downloads
Patches
Plain Diff
Add skeleton of phpunit
parent
b3d37c39
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
phpunit.xml.dist
+29
-0
29 additions, 0 deletions
phpunit.xml.dist
tests/phpunit/bootstrap.php
+49
-0
49 additions, 0 deletions
tests/phpunit/bootstrap.php
with
78 additions
and
0 deletions
phpunit.xml.dist
0 → 100644
+
29
−
0
View file @
35a987c2
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/phpunit/bootstrap.php"
>
<testsuites>
<testsuite name="My Test Suite">
<directory>./tests/phpunit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./</directory>
</whitelist>
</filter>
<listeners>
<listener class="Civi\Test\CiviTestListener">
<arguments></arguments>
</listener>
</listeners>
</phpunit>
This diff is collapsed.
Click to expand it.
tests/phpunit/bootstrap.php
0 → 100644
+
49
−
0
View file @
35a987c2
<?php
ini_set
(
'memory_limit'
,
'2G'
);
ini_set
(
'safe_mode'
,
0
);
eval
(
cv
(
'php:boot --level=classloader'
,
'phpcode'
));
/**
* Call the "cv" command.
*
* @param string $cmd
* The rest of the command to send.
* @param string $decode
* Ex: 'json' or 'phpcode'.
* @return string
* Response output (if the command executed normally).
* @throws \RuntimeException
* If the command terminates abnormally.
*/
function
cv
(
$cmd
,
$decode
=
'json'
)
{
$cmd
=
'cv '
.
$cmd
;
$descriptorSpec
=
array
(
0
=>
array
(
"pipe"
,
"r"
),
1
=>
array
(
"pipe"
,
"w"
),
2
=>
STDERR
);
$oldOutput
=
getenv
(
'CV_OUTPUT'
);
putenv
(
"CV_OUTPUT=json"
);
$process
=
proc_open
(
$cmd
,
$descriptorSpec
,
$pipes
,
__DIR__
);
putenv
(
"CV_OUTPUT=
$oldOutput
"
);
fclose
(
$pipes
[
0
]);
$result
=
stream_get_contents
(
$pipes
[
1
]);
fclose
(
$pipes
[
1
]);
if
(
proc_close
(
$process
)
!==
0
)
{
throw
new
RuntimeException
(
"Command failed (
$cmd
):
\n
$result
"
);
}
switch
(
$decode
)
{
case
'raw'
:
return
$result
;
case
'phpcode'
:
// If the last output is /*PHPCODE*/, then we managed to complete execution.
if
(
substr
(
trim
(
$result
),
0
,
12
)
!==
"/*BEGINPHP*/"
||
substr
(
trim
(
$result
),
-
10
)
!==
"/*ENDPHP*/"
)
{
throw
new
\RuntimeException
(
"Command failed (
$cmd
):
\n
$result
"
);
}
return
$result
;
case
'json'
:
return
json_decode
(
$result
,
1
);
default
:
throw
new
RuntimeException
(
"Bad decoder format (
$decode
)"
);
}
}
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