Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
E
extensions.typo3.org
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
62
Issues
62
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
9
Merge Requests
9
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
services
extensions.typo3.org
extensions.typo3.org
Commits
6b088050
Commit
6b088050
authored
Jan 20, 2018
by
Thomas Löffler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First changes of unit tests
* Adds build task for tests * Changes tests to namespaces
parent
cb756b2e
Pipeline
#3404
failed with stages
in 11 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
21 deletions
+74
-21
.gitlab-ci.yml
.gitlab-ci.yml
+13
-0
.gitlab-ci/Tests/UnitTests.xml
.gitlab-ci/Tests/UnitTests.xml
+21
-0
html/typo3conf/ext/ter_fe2/Tests/Unit/Domain/Model/ExtensionTest.php
...onf/ext/ter_fe2/Tests/Unit/Domain/Model/ExtensionTest.php
+15
-7
html/typo3conf/ext/ter_fe2/Tests/Unit/Task/CheckForOutdatedExtensionsTest.php
...er_fe2/Tests/Unit/Task/CheckForOutdatedExtensionsTest.php
+15
-8
html/typo3conf/ext/ter_fe2/Tests/Unit/Utility/ArchiveUtilityTest.php
...onf/ext/ter_fe2/Tests/Unit/Utility/ArchiveUtilityTest.php
+10
-6
No files found.
.gitlab-ci.yml
View file @
6b088050
...
...
@@ -12,10 +12,23 @@ before_script:
stages
:
-
dump
-
test
-
build
-
layout
-
deploy
test
:
stage
:
test
image
:
php:7.0-alpine
before_script
:
-
export TYPO3_PATH_WEB="$PWD/.Build/Web"
-
export COMPOSER_CACHE_DIR=.cache/composer
-
php -r "copy('https://getcomposer.org/composer.phar', 'composer.phar');"
-
php composer.phar install
script
:
-
bin/phpunit -c .gitlab-ci/Tests/UnitTests.xml
build
:
stage
:
build
image
:
php:7.0-alpine
...
...
.gitlab-ci/Tests/UnitTests.xml
0 → 100644
View file @
6b088050
<phpunit
backupGlobals=
"true"
backupStaticAttributes=
"false"
bootstrap=
"../../vendor/nimut/testing-framework/src/TestingFramework/Bootstrap/UnitTestsBootstrap.php"
colors=
"true"
convertErrorsToExceptions=
"true"
convertWarningsToExceptions=
"true"
forceCoversAnnotation=
"false"
processIsolation=
"false"
stopOnError=
"false"
stopOnFailure=
"false"
stopOnIncomplete=
"false"
stopOnSkipped=
"false"
verbose=
"false"
>
<testsuites>
<testsuite
name=
"ter_fe2 tests"
>
<directory>
../../html/typo3conf/ext/ter_fe2/Tests/Unit
</directory>
</testsuite>
</testsuites>
</phpunit>
html/typo3conf/ext/ter_fe2/Tests/Unit/Domain/Model/ExtensionTest.php
View file @
6b088050
<?php
namespace
T3o\TerFe2\Tests\Unit\Domain\Model
;
/*******************************************************************
* Copyright notice
*
...
...
@@ -26,17 +28,17 @@
/**
* Tests for the Extension Model
*/
class
Tx_TerFe2_Domain_Model_ExtensionTest
extends
Tx_Phpunit_
TestCase
class
ExtensionTest
extends
\
Nimut\TestingFramework\TestCase\Unit
TestCase
{
/**
* @var
Tx_TerFe2_Domain_Model_
Extension
* @var
\T3o\TerFe2\Domain\Model\
Extension
*/
protected
$fixture
;
public
function
setUp
()
{
$this
->
fixture
=
new
Tx_TerFe2_Domain_Model_
Extension
();
$this
->
fixture
=
new
\
T3o\TerFe2\Domain\Model\
Extension
();
$this
->
addVersionsToExtension
(
$this
->
fixture
);
}
...
...
@@ -45,10 +47,16 @@ class Tx_TerFe2_Domain_Model_ExtensionTest extends Tx_Phpunit_TestCase
unset
(
$this
->
fixture
);
}
protected
function
addVersionsToExtension
(
$extension
,
$amount
=
4
)
/**
* @test
* @param \T3o\TerFe2\Domain\Model\Extension $extension
* @param int $amount
* @return void
*/
public
function
addVersionsToExtension
(
\
T3o\TerFe2\Domain\Model\Extension
$extension
,
$amount
=
4
)
{
for
(
$index
=
1
;
$index
<=
$amount
;
$index
++
)
{
$version
=
new
Tx_TerFe2_Domain_Model_
Version
();
$version
=
new
\
T3o\TerFe2\Domain\Model\
Version
();
$version
->
setExtension
(
$this
->
fixture
);
$version
->
setVersionNumber
(
$index
);
$version
->
setVersionString
(
'0.0.'
.
(
string
)
$index
);
...
...
@@ -92,7 +100,7 @@ class Tx_TerFe2_Domain_Model_ExtensionTest extends Tx_Phpunit_TestCase
*/
public
function
tryingToRemoveAVersionWhichDoesNotBelongToTheExtensionThrowsException
()
{
$version
=
new
Tx_TerFe2_Domain_Model_
Version
();
$version
=
new
\
T3o\TerFe2\Domain\Model\
Version
();
$this
->
fixture
->
removeVersion
(
$version
);
}
...
...
@@ -101,7 +109,7 @@ class Tx_TerFe2_Domain_Model_ExtensionTest extends Tx_Phpunit_TestCase
*/
public
function
removingTheLastVersionSetsLastVersionToNull
()
{
$extension
=
new
Tx_TerFe2_Domain_Model_
Extension
();
$extension
=
new
\
T3o\TerFe2\Domain\Model\
Extension
();
$this
->
addVersionsToExtension
(
$extension
,
1
);
$extension
->
removeVersion
(
$extension
->
getLastVersion
());
...
...
html/typo3conf/ext/ter_fe2/Tests/Unit/Task/CheckForOutdatedExtensionsT
askT
est.php
→
html/typo3conf/ext/ter_fe2/Tests/Unit/Task/CheckForOutdatedExtensionsTest.php
View file @
6b088050
<?php
namespace
T3o\TerFe2\Tests\Unit\Task
;
/*******************************************************************
* Copyright notice
...
...
@@ -24,11 +25,17 @@
*
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
class
Tx_TerFe2_Test_Task_CheckForOutdatedExtensionsTest
extends
tx_phpunit_testcase
/**
* Class CheckForOutdatedExtensionsTest
*
* @author Thomas Löffler <loeffler@spooner-web.de>
*/
class
CheckForOutdatedExtensionsTest
extends
\
Nimut\TestingFramework\TestCase\UnitTestCase
{
/**
* @var
Tx_TerFe2_Task_
CheckForOutdatedExtensions
* @var
\T3o\TerFe2\Task\
CheckForOutdatedExtensions
*/
protected
$subject
=
null
;
...
...
@@ -56,7 +63,7 @@ class Tx_TerFe2_Test_Task_CheckForOutdatedExtensionsTest extends tx_phpunit_test
public
function
setUp
()
{
$this
->
subject
=
$this
->
getAccessibleMock
(
'Tx_TerFe2_Task_CheckForOutdatedExtensions'
,
\
T3o\TerFe2\Task\CheckForOutdatedExtensions
::
class
,
array
(
'dummy'
)
);
}
...
...
@@ -68,14 +75,14 @@ class Tx_TerFe2_Test_Task_CheckForOutdatedExtensionsTest extends tx_phpunit_test
public
function
subjectExists
()
{
$this
->
assertInstanceOf
(
'Tx_TerFe2_Task_CheckForOutdatedExtensions'
,
\
T3o\TerFe2\Task\CheckForOutdatedExtensions
::
class
,
$this
->
subject
);
}
/**
* @test
* @param
Tx_TerFe2_Domain_Model_
Relation $dependency
* @param
\T3o\TerFe2\Domain\Model\
Relation $dependency
* @dataProvider isVersionDependingOnAnActiveSupportedTypo3VersionReturnsTrueForSupportedVersionsDataProvider
* @return void
*/
...
...
@@ -134,7 +141,7 @@ class Tx_TerFe2_Test_Task_CheckForOutdatedExtensionsTest extends tx_phpunit_test
/**
* @test
* @param
Tx_TerFe2_Domain_Model_
Relation $dependency
* @param
\T3o\TerFe2\Domain\Model\
Relation $dependency
* @dataProvider isVersionDependingOnAnActiveSupportedTypo3VersionReturnsFalseForUnsupportedVersionsDataProvider
* @return void
*/
...
...
@@ -168,11 +175,11 @@ class Tx_TerFe2_Test_Task_CheckForOutdatedExtensionsTest extends tx_phpunit_test
* @param string $minVersion
* @param string $maxVersion
*
* @return
Tx_TerFe2_Domain_Model_
Relation
* @return
\T3o\TerFe2\Domain\Model\
Relation
*/
protected
function
buildRelation
(
$minVersion
,
$maxVersion
)
{
$relation
=
new
Tx_TerFe2_Domain_Model_
Relation
();
$relation
=
new
\
T3o\TerFe2\Domain\Model\
Relation
();
$relation
->
setMinimumVersion
(
\
TYPO3\CMS\Core\Utility\VersionNumberUtility
::
convertVersionNumberToInteger
(
$minVersion
));
$relation
->
setMaximumVersion
(
\
TYPO3\CMS\Core\Utility\VersionNumberUtility
::
convertVersionNumberToInteger
(
$maxVersion
));
...
...
html/typo3conf/ext/ter_fe2/Tests/Unit/Utility/ArchiveTest.php
→
html/typo3conf/ext/ter_fe2/Tests/Unit/Utility/Archive
Utility
Test.php
View file @
6b088050
<?php
namespace
T3o\TerFe2\Tests\Unit\Utility
;
/**
* This file is part of the TYPO3 CMS project.
*
...
...
@@ -13,9 +15,11 @@
*/
/**
* Class Tx_TerFe2_Utility_ArchiveTest
* Class ArchiveUtilityTest
*
* @author Thomas Löffler <loeffler@spooner-web.de>
*/
class
Tx_TerFe2_Utility_ArchiveTest
extends
\
tx_phpunit_testc
ase
class
ArchiveUtilityTest
extends
\
Nimut\TestingFramework\TestCase\UnitTestC
ase
{
/**
...
...
@@ -27,7 +31,7 @@ class Tx_TerFe2_Utility_ArchiveTest extends \tx_phpunit_testcase
public
function
extractEmConfReturnsFullAndValidDataArray
(
$code
,
$expected
)
{
$subject
=
$this
->
getAccessibleMock
(
'Tx_TerFe2_Utility_Archive'
,
\
T3o\TerFe2\Utility\ArchiveUtility
::
class
,
array
(
'dummy'
)
);
$emConf
=
$subject
->
_call
(
'extractEmConf'
,
$code
);
...
...
@@ -75,7 +79,7 @@ class Tx_TerFe2_Utility_ArchiveTest extends \tx_phpunit_testcase
$expected
=
array
(
'bar'
=>
'baz'
);
$subject
=
$this
->
getAccessibleMock
(
'Tx_TerFe2_Utility_Archive'
,
\
T3o\TerFe2\Utility\ArchiveUtility
::
class
,
array
(
'dummy'
)
);
$emConf
=
$subject
->
_call
(
'extractEmConf'
,
$code
);
...
...
@@ -92,7 +96,7 @@ class Tx_TerFe2_Utility_ArchiveTest extends \tx_phpunit_testcase
$code
=
'<?php $EM_CONF[$_EXTKEY] = array(\'bar\' => \'baz\'); $foo = TRUE ?>'
;
$subject
=
$this
->
getAccessibleMock
(
'Tx_TerFe2_Utility_Archive'
,
\
T3o\TerFe2\Utility\ArchiveUtility
::
class
,
array
(
'dummy'
)
);
$emConf
=
$subject
->
_call
(
'extractEmConf'
,
$code
);
...
...
@@ -108,7 +112,7 @@ class Tx_TerFe2_Utility_ArchiveTest extends \tx_phpunit_testcase
$code
=
'<?php $EM_CONFOTHER[$_EXTKEY] = array(\'bar\' => \'baz\'); ?>'
;
$subject
=
$this
->
getAccessibleMock
(
'Tx_TerFe2_Utility_Archive'
,
\
T3o\TerFe2\Utility\ArchiveUtility
::
class
,
array
(
'dummy'
)
);
$emConf
=
$subject
->
_call
(
'extractEmConf'
,
$code
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment