Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Memorekall Member New
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rekall
Memorekall Member New
Commits
c0be3dac
Commit
c0be3dac
authored
3 years ago
by
Sebastien
Browse files
Options
Downloads
Patches
Plain Diff
Test code refactoring
parent
ade9789a
No related branches found
No related tags found
1 merge request
!84
Tuleap 198 get rid of create zip
Pipeline
#1004
passed
3 years ago
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/TestFileHelper.php
+23
-0
23 additions, 0 deletions
tests/TestFileHelper.php
tests/functional/CapsuleControllerTest.php
+2
-8
2 additions, 8 deletions
tests/functional/CapsuleControllerTest.php
tests/functional/ProjectControllerTest.php
+2
-8
2 additions, 8 deletions
tests/functional/ProjectControllerTest.php
with
27 additions
and
16 deletions
tests/TestFileHelper.php
0 → 100644
+
23
−
0
View file @
c0be3dac
<?php
namespace
App\Tests
;
use
PHPUnit\Framework\Assert
;
use
Symfony\Component\Filesystem\Filesystem
;
class
TestFileHelper
{
private
const
LEGACY_DIRECTORY
=
__DIR__
.
'/../legacy'
;
public
static
function
createLegacyDirectoryIfNecessary
(
Assert
$testCase
):
void
{
$fileSystem
=
new
Filesystem
();
if
(
!
$fileSystem
->
exists
(
self
::
LEGACY_DIRECTORY
))
{
$fileSystem
->
mkdir
(
self
::
LEGACY_DIRECTORY
,
0644
);
}
$testCase
->
assertTrue
(
$fileSystem
->
exists
(
self
::
LEGACY_DIRECTORY
),
'The directory \''
.
self
::
LEGACY_DIRECTORY
.
'\' should exists'
);
}
}
This diff is collapsed.
Click to expand it.
tests/functional/CapsuleControllerTest.php
+
2
−
8
View file @
c0be3dac
...
@@ -4,6 +4,7 @@ namespace App\Tests\functional;
...
@@ -4,6 +4,7 @@ namespace App\Tests\functional;
use
App\Entity\Capsule
;
use
App\Entity\Capsule
;
use
App\Entity\User
;
use
App\Entity\User
;
use
App\Tests\TestFileHelper
;
use
Symfony\Bundle\FrameworkBundle\Test\WebTestCase
;
use
Symfony\Bundle\FrameworkBundle\Test\WebTestCase
;
use
Symfony\Component\Filesystem\Filesystem
;
use
Symfony\Component\Filesystem\Filesystem
;
...
@@ -16,14 +17,7 @@ class CapsuleControllerTest extends WebTestCase
...
@@ -16,14 +17,7 @@ class CapsuleControllerTest extends WebTestCase
protected
function
setUp
():
void
protected
function
setUp
():
void
{
{
$fileSystem
=
new
Filesystem
();
TestFileHelper
::
createLegacyDirectoryIfNecessary
(
$this
);
if
(
!
$fileSystem
->
exists
(
self
::
TEST_DIR_PATH
))
{
$fileSystem
->
mkdir
(
self
::
TEST_DIR_PATH
,
0644
);
}
$this
->
assertTrue
(
$fileSystem
->
exists
(
self
::
TEST_DIR_PATH
),
'The directory \''
.
self
::
TEST_DIR_PATH
.
'\' should exists'
);
chdir
(
self
::
TEST_DIR_PATH
);
chdir
(
self
::
TEST_DIR_PATH
);
self
::
ensureKernelShutdown
();
self
::
ensureKernelShutdown
();
...
...
This diff is collapsed.
Click to expand it.
tests/functional/ProjectControllerTest.php
+
2
−
8
View file @
c0be3dac
...
@@ -4,6 +4,7 @@ namespace App\Tests\functional;
...
@@ -4,6 +4,7 @@ namespace App\Tests\functional;
use
App\Entity\Capsule
;
use
App\Entity\Capsule
;
use
App\Entity\User
;
use
App\Entity\User
;
use
App\Tests\TestFileHelper
;
use
Doctrine\Persistence\ObjectManager
;
use
Doctrine\Persistence\ObjectManager
;
use
Symfony\Bundle\FrameworkBundle\KernelBrowser
;
use
Symfony\Bundle\FrameworkBundle\KernelBrowser
;
use
Symfony\Bundle\FrameworkBundle\Test\WebTestCase
;
use
Symfony\Bundle\FrameworkBundle\Test\WebTestCase
;
...
@@ -21,14 +22,7 @@ class ProjectControllerTest extends WebTestCase
...
@@ -21,14 +22,7 @@ class ProjectControllerTest extends WebTestCase
protected
function
setUp
():
void
protected
function
setUp
():
void
{
{
$fileSystem
=
new
Filesystem
();
TestFileHelper
::
createLegacyDirectoryIfNecessary
(
$this
);
if
(
!
$fileSystem
->
exists
(
self
::
TEST_DIR_PATH
))
{
$fileSystem
->
mkdir
(
self
::
TEST_DIR_PATH
,
0644
);
}
$this
->
assertTrue
(
$fileSystem
->
exists
(
self
::
TEST_DIR_PATH
),
'The directory \''
.
self
::
TEST_DIR_PATH
.
'\' should exists'
);
chdir
(
self
::
TEST_DIR_PATH
);
chdir
(
self
::
TEST_DIR_PATH
);
self
::
ensureKernelShutdown
();
self
::
ensureKernelShutdown
();
...
...
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