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
6754be6e
Commit
6754be6e
authored
Apr 15, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added unittests for update query configuration mode
parent
cbe9a496
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
0 deletions
+89
-0
tests/Solarium/Query/UpdateTest.php
tests/Solarium/Query/UpdateTest.php
+89
-0
No files found.
tests/Solarium/Query/UpdateTest.php
View file @
6754be6e
...
@@ -270,4 +270,93 @@ class Solarium_Query_UpdateTest extends PHPUnit_Framework_TestCase
...
@@ -270,4 +270,93 @@ class Solarium_Query_UpdateTest extends PHPUnit_Framework_TestCase
);
);
}
}
public
function
testConstructorWithConfig
()
{
$config
=
array
(
'command'
=>
array
(
'key1'
=>
array
(
'type'
=>
'delete'
,
'query'
=>
'population:[* TO 1000]'
,
'id'
=>
array
(
1
,
2
),
),
'key2'
=>
array
(
'type'
=>
'commit'
,
'waitflush'
=>
true
,
'waitsearcher'
=>
false
,
'expungedeletes'
=>
true
,
),
'key3'
=>
array
(
'type'
=>
'optimize'
,
'waitflush'
=>
true
,
'waitsearcher'
=>
false
,
'maxsegments'
=>
5
,
),
'key4'
=>
array
(
'type'
=>
'rollback'
,
)
)
);
$query
=
new
Solarium_Query_Update
(
$config
);
$commands
=
$query
->
getCommands
();
$delete
=
$commands
[
'key1'
];
$this
->
assertEquals
(
array
(
1
,
2
),
$delete
->
getIds
()
);
$this
->
assertEquals
(
array
(
'population:[* TO 1000]'
),
$delete
->
getQueries
()
);
$commit
=
$commands
[
'key2'
];
$this
->
assertEquals
(
true
,
$commit
->
getWaitFlush
()
);
$this
->
assertEquals
(
false
,
$commit
->
getWaitSearcher
()
);
$this
->
assertEquals
(
true
,
$commit
->
getExpungeDeletes
()
);
$optimize
=
$commands
[
'key3'
];
$this
->
assertEquals
(
true
,
$optimize
->
getWaitFlush
()
);
$this
->
assertEquals
(
false
,
$optimize
->
getWaitSearcher
()
);
$this
->
assertEquals
(
5
,
$optimize
->
getMaxSegments
()
);
$rollback
=
$commands
[
'key4'
];
$this
->
assertEquals
(
'Solarium_Query_Update_Command_Rollback'
,
get_class
(
$rollback
)
);
}
public
function
testConstructorWithConfigAddCommand
()
{
$config
=
array
(
'command'
=>
array
(
'key1'
=>
array
(
'type'
=>
'add'
,
),
)
);
$this
->
setExpectedException
(
'Solarium_Exception'
);
new
Solarium_Query_Update
(
$config
);
}
}
}
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