Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
composer-phpcodesniffer-standards-plugin
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
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
Daniel Siepmann
composer-phpcodesniffer-standards-plugin
Commits
f957d7e8
There was an error fetching the commit references. Please try again later.
Commit
f957d7e8
authored
7 years ago
by
Daniel Hürtgen
Browse files
Options
Downloads
Patches
Plain Diff
FEATURE: Mock standard factory
parent
f606733a
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/PHPCodeSniffer/StandardsFactoryTest.php
+22
-1
22 additions, 1 deletion
tests/src/PHPCodeSniffer/StandardsFactoryTest.php
with
22 additions
and
1 deletion
tests/src/PHPCodeSniffer/StandardsFactoryTest.php
+
22
−
1
View file @
f957d7e8
...
...
@@ -21,6 +21,7 @@ namespace Higidi\ComposerPhpCSStandardsPlugin\Tests\PHPCodeSniffer;
* 02110-1301, USA.
*/
use
Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standard\Factory
as
StandardFactory
;
use
Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\StandardsFactory
;
/**
...
...
@@ -33,15 +34,30 @@ class StandardsFactoryTest extends \PHPUnit_Framework_TestCase
*/
protected
$fixture
;
/**
* @var StandardFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected
$standardFactoryMock
;
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
fixture
=
new
StandardsFactory
();
$this
->
standardFactoryMock
=
$this
->
createMock
(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standard\Factory'
);
$this
->
standardFactoryMock
->
method
(
'create'
)
->
willReturn
(
$this
->
createMock
(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standard\Standard'
)
);
$this
->
fixture
=
new
StandardsFactory
(
$this
->
standardFactoryMock
);
}
protected
function
tearDown
()
{
parent
::
tearDown
();
unset
(
$this
->
standardFactoryMock
);
unset
(
$this
->
fixture
);
}
...
...
@@ -52,6 +68,11 @@ class StandardsFactoryTest extends \PHPUnit_Framework_TestCase
DIRECTORY_SEPARATOR
,
array
(
__DIR__
,
'..'
,
'..'
,
'Fixtures'
,
'Standards'
,
'Standard1'
)
);
$this
->
standardFactoryMock
->
expects
(
$this
->
exactly
(
count
(
$paths
)))
->
method
(
'create'
)
->
withConsecutive
(
$paths
);
$standards
=
$this
->
fixture
->
create
(
$paths
);
$this
->
assertInstanceOf
(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards'
,
$standards
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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