Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EcomDev_PHPUnit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Open
EcomDev_PHPUnit
Commits
d6d016a1
Commit
d6d016a1
authored
Apr 18, 2011
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
! Committing missed files from previous version
parent
951f9bba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
0 deletions
+84
-0
app/code/community/EcomDev/PHPUnit/Test/Suite/Group.php
app/code/community/EcomDev/PHPUnit/Test/Suite/Group.php
+84
-0
No files found.
app/code/community/EcomDev/PHPUnit/Test/Suite/Group.php
0 → 100644
View file @
d6d016a1
<?php
/**
* PHP Unit test suite for Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @category EcomDev
* @package EcomDev_PHPUnit
* @copyright Copyright (c) 2011 Ecommerce Developers (http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
*/
/**
* Test suite for a group of tests (e.g. tests from the same class)
*
*/
class
EcomDev_PHPUnit_Test_Suite_Group
extends
PHPUnit_Framework_TestSuite
{
const
NO_GROUP_KEYWORD
=
'__nogroup__'
;
/**
* Contructor adds test groups defined on global level
* and adds additional logic for test names retrieval
*
* (non-PHPdoc)
* @see PHPUnit_Framework_TestSuite::__construct()
* @param array $groups
*/
public
function
__construct
(
$theClass
=
''
,
$groups
=
array
())
{
if
(
!
$theClass
instanceof
ReflectionClass
)
{
$theClass
=
EcomDev_Utils_Reflection
::
getRelflection
(
$theClass
);
}
// Check annotations for test case name
$annotations
=
PHPUnit_Util_Test
::
parseTestMethodAnnotations
(
$theClass
->
getName
()
);
if
(
isset
(
$annotation
[
'name'
]))
{
$name
=
$annotations
[
'name'
];
}
else
{
$name
=
sprintf
(
'Test suite for %s'
,
$theClass
->
getName
());
}
// Creates all test instances
parent
::
__construct
(
$theClass
,
$name
);
// Just sort-out them by our internal groups
foreach
(
$groups
as
$group
)
{
$this
->
groups
[
$group
]
=
$this
->
tests
();
}
foreach
(
$this
->
tests
()
as
$test
)
{
if
(
$test
instanceof
PHPUnit_Framework_TestSuite
)
{
/* @todo
* Post an issue into PHPUnit bugtracker for
* impossiblity for specifying group by parent test case
* Becuase it is a very dirty hack :(
**/
$testGroups
=
array
();
foreach
(
$groups
as
$group
)
{
$testGroups
[
$group
]
=
$test
->
tests
();
}
EcomDev_Utils_Reflection
::
setRestrictedPropertyValue
(
$test
,
'groups'
,
$testGroups
);
}
}
// Remove ungrouped tests group, if it exists
if
(
isset
(
$this
->
groups
[
self
::
NO_GROUP_KEYWORD
]))
{
unset
(
$this
->
groups
[
self
::
NO_GROUP_KEYWORD
]);
}
}
}
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