Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
4516c2fe
Commit
4516c2fe
authored
Oct 14, 2013
by
Baldur Rensch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the fixture laoder not having an executor
parent
3da1cf40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
5 deletions
+41
-5
library/Solarium/Support/DataFixtures/FixtureLoader.php
library/Solarium/Support/DataFixtures/FixtureLoader.php
+14
-3
tests/Solarium/Tests/Support/DataFixtures/FixtureLoaderTest.php
...Solarium/Tests/Support/DataFixtures/FixtureLoaderTest.php
+27
-2
No files found.
library/Solarium/Support/DataFixtures/FixtureLoader.php
View file @
4516c2fe
...
...
@@ -3,6 +3,8 @@
namespace
Solarium\Support\DataFixtures
;
/**
* This class is just a convenience wrapper around the fixture loading process.
*
* @author Baldur Rensch <brensch@gmail.com>
*/
class
FixtureLoader
...
...
@@ -18,13 +20,20 @@ class FixtureLoader
private
$purger
;
/**
* @param Loader $loader
* @param Purger $purger
* @var Executor
*/
public
function
__construct
(
Loader
$loader
,
Purger
$purger
)
private
$executor
;
/**
* @param Loader $loader
* @param Purger $purger
* @param Executor $executor
*/
public
function
__construct
(
Loader
$loader
,
Purger
$purger
,
Executor
$executor
)
{
$this
->
loader
=
$loader
;
$this
->
purger
=
$purger
;
$this
->
executor
=
$executor
;
}
/**
...
...
@@ -38,5 +47,7 @@ class FixtureLoader
}
$this
->
loader
->
loadFromDirectory
(
$dir
);
$this
->
executor
->
execute
(
$this
->
loader
->
getFixtures
());
}
}
tests/Solarium/Tests/Support/DataFixtures/FixtureLoaderTest.php
View file @
4516c2fe
...
...
@@ -3,6 +3,7 @@
namespace
Solarium\Tests\Support\DataFixtures
;
use
Solarium\Support\DataFixtures\FixtureLoader
;
use
Solarium\Tests\Support\DataFixtures\Fixtures\MockFixture1
;
class
FixtureLoaderTest
extends
\PHPUnit_Framework_TestCase
{
...
...
@@ -14,8 +15,9 @@ class FixtureLoaderTest extends \PHPUnit_Framework_TestCase
{
$loader
=
$this
->
mockLoader
();
$purger
=
$this
->
mockPurger
(
false
);
$executor
=
$this
->
mockExecutor
();
$fixtureLoader
=
new
FixtureLoader
(
$loader
,
$purger
);
$fixtureLoader
=
new
FixtureLoader
(
$loader
,
$purger
,
$executor
);
$fixtureLoader
->
loadFixturesFromDir
(
$this
->
fixturePath
);
}
...
...
@@ -24,8 +26,9 @@ class FixtureLoaderTest extends \PHPUnit_Framework_TestCase
{
$loader
=
$this
->
mockLoader
();
$purger
=
$this
->
mockPurger
(
true
);
$executor
=
$this
->
mockExecutor
();
$fixtureLoader
=
new
FixtureLoader
(
$loader
,
$purger
);
$fixtureLoader
=
new
FixtureLoader
(
$loader
,
$purger
,
$executor
);
$fixtureLoader
->
loadFixturesFromDir
(
$this
->
fixturePath
,
false
);
}
...
...
@@ -44,6 +47,16 @@ class FixtureLoaderTest extends \PHPUnit_Framework_TestCase
->
method
(
'loadFromDirectory'
)
->
with
(
$this
->
fixturePath
);
$loader
->
expects
(
$this
->
once
())
->
method
(
'getFixtures'
)
->
will
(
$this
->
returnValue
(
array
(
$this
->
getMockFixture
()
)
)
);
return
$loader
;
}
...
...
@@ -56,4 +69,16 @@ class FixtureLoaderTest extends \PHPUnit_Framework_TestCase
return
$purger
;
}
private
function
mockExecutor
()
{
$executor
=
$this
->
getMock
(
'Solarium\Support\DataFixtures\Executor'
,
array
(),
array
(
$this
->
client
));
return
$executor
;
}
private
function
getMockFixture
()
{
return
new
MockFixture1
();
}
}
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