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
a2ea6900
Commit
a2ea6900
authored
Jun 11, 2017
by
Bas de Nooijer
Committed by
GitHub
Jun 11, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #507 from localheinz/fix/assertion
Fix: Use more appropriate assertion
parents
312b4da4
787ba075
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
32 additions
and
42 deletions
+32
-42
tests/Solarium/Tests/Core/Client/Adapter/Guzzle3Test.php
tests/Solarium/Tests/Core/Client/Adapter/Guzzle3Test.php
+5
-5
tests/Solarium/Tests/Core/Client/Adapter/GuzzleTest.php
tests/Solarium/Tests/Core/Client/Adapter/GuzzleTest.php
+1
-1
tests/Solarium/Tests/Plugin/Loadbalancer/WeightedRandomChoiceTest.php
...um/Tests/Plugin/Loadbalancer/WeightedRandomChoiceTest.php
+1
-1
tests/Solarium/Tests/Plugin/MinimumScoreFilter/ResultTest.php
...s/Solarium/Tests/Plugin/MinimumScoreFilter/ResultTest.php
+1
-1
tests/Solarium/Tests/Plugin/PrefetchIteratorTest.php
tests/Solarium/Tests/Plugin/PrefetchIteratorTest.php
+3
-3
tests/Solarium/Tests/QueryType/MoreLikeThis/QueryTest.php
tests/Solarium/Tests/QueryType/MoreLikeThis/QueryTest.php
+1
-1
tests/Solarium/Tests/QueryType/Select/Query/AbstractQueryTest.php
...larium/Tests/QueryType/Select/Query/AbstractQueryTest.php
+1
-1
tests/Solarium/Tests/QueryType/Select/Query/Component/DistributedSearchTest.php
...ueryType/Select/Query/Component/DistributedSearchTest.php
+6
-6
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/DebugTest.php
...s/QueryType/Select/ResponseParser/Component/DebugTest.php
+6
-6
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/StatsTest.php
...s/QueryType/Select/ResponseParser/Component/StatsTest.php
+1
-1
tests/Solarium/Tests/QueryType/Select/Result/AbstractDocumentTest.php
...um/Tests/QueryType/Select/Result/AbstractDocumentTest.php
+4
-14
tests/Solarium/Tests/QueryType/Terms/ResponseParserTest.php
tests/Solarium/Tests/QueryType/Terms/ResponseParserTest.php
+2
-2
No files found.
tests/Solarium/Tests/Core/Client/Adapter/Guzzle3Test.php
View file @
a2ea6900
...
...
@@ -102,7 +102,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$receivedRequests
=
$plugin
->
getReceivedRequests
();
$this
->
assert
Same
(
1
,
count
(
$receivedRequests
)
);
$this
->
assert
Count
(
1
,
$receivedRequests
);
$this
->
assertSame
(
'GET'
,
$receivedRequests
[
0
]
->
getMethod
());
$this
->
assertSame
(
...
...
@@ -149,10 +149,10 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$receivedRequests
=
$plugin
->
getReceivedRequests
();
$this
->
assert
Same
(
1
,
count
(
$receivedRequests
)
);
$this
->
assert
Count
(
1
,
$receivedRequests
);
$this
->
assertSame
(
'POST'
,
$receivedRequests
[
0
]
->
getMethod
());
$this
->
assertS
ame
(
file_get_contents
(
__FILE__
)
,
(
string
)
$receivedRequests
[
0
]
->
getBody
());
$this
->
assertS
tringEqualsFile
(
__FILE__
,
(
string
)
$receivedRequests
[
0
]
->
getBody
());
$this
->
assertSame
(
'request value'
,
(
string
)
$receivedRequests
[
0
]
->
getHeader
(
'X-PHPUnit'
)
...
...
@@ -198,7 +198,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$receivedRequests
=
$plugin
->
getReceivedRequests
();
$this
->
assert
Same
(
1
,
count
(
$receivedRequests
)
);
$this
->
assert
Count
(
1
,
$receivedRequests
);
$this
->
assertSame
(
'POST'
,
$receivedRequests
[
0
]
->
getMethod
());
$this
->
assertSame
(
$xml
,
(
string
)
$receivedRequests
[
0
]
->
getBody
());
...
...
@@ -250,7 +250,7 @@ final class Guzzle3Test extends \PHPUnit_Framework_TestCase
$receivedRequests
=
$plugin
->
getReceivedRequests
();
$this
->
assert
Same
(
1
,
count
(
$receivedRequests
)
);
$this
->
assert
Count
(
1
,
$receivedRequests
);
$this
->
assertSame
(
'GET'
,
$receivedRequests
[
0
]
->
getMethod
());
$this
->
assertSame
(
...
...
tests/Solarium/Tests/Core/Client/Adapter/GuzzleTest.php
View file @
a2ea6900
...
...
@@ -155,7 +155,7 @@ final class GuzzleAdapterTest extends \PHPUnit_Framework_TestCase
$this
->
assertCount
(
1
,
$container
);
$this
->
assertSame
(
'POST'
,
$container
[
0
][
'request'
]
->
getMethod
());
$this
->
assertSame
(
'request value'
,
$container
[
0
][
'request'
]
->
getHeaderline
(
'X-PHPUnit'
));
$this
->
assertS
ame
(
file_get_contents
(
__FILE__
)
,
(
string
)
$container
[
0
][
'request'
]
->
getBody
());
$this
->
assertS
tringEqualsFile
(
__FILE__
,
(
string
)
$container
[
0
][
'request'
]
->
getBody
());
}
/**
...
...
tests/Solarium/Tests/Plugin/Loadbalancer/WeightedRandomChoiceTest.php
View file @
a2ea6900
...
...
@@ -65,7 +65,7 @@ class WeightedRandomChoiceTest extends \PHPUnit_Framework_TestCase
$key
=
$randomizer
->
getRandom
(
$excludes
);
$this
->
assert
True
(
$key
!==
'key3'
);
$this
->
assert
NotSame
(
$key
,
'key3'
);
}
public
function
testAllEntriesExcluded
()
...
...
tests/Solarium/Tests/Plugin/MinimumScoreFilter/ResultTest.php
View file @
a2ea6900
...
...
@@ -85,7 +85,7 @@ class ResultTest extends AbstractResultTest
$result
=
new
FilterResultDummy
(
1
,
12
,
$this
->
numFound
,
$this
->
maxScore
,
$this
->
docs
,
$this
->
components
,
Query
::
FILTER_MODE_REMOVE
);
$docs
=
$result
->
getDocuments
();
$this
->
assert
Equals
(
3
,
count
(
$docs
)
);
$this
->
assert
Count
(
3
,
$docs
);
$this
->
assertEquals
(
$docs
[
0
]
->
title
,
$this
->
docs
[
0
]
->
title
);
$this
->
assertEquals
(
$docs
[
1
]
->
title
,
$this
->
docs
[
1
]
->
title
);
$this
->
assertEquals
(
$docs
[
2
]
->
title
,
$this
->
docs
[
2
]
->
title
);
...
...
tests/Solarium/Tests/Plugin/PrefetchIteratorTest.php
View file @
a2ea6900
...
...
@@ -86,7 +86,7 @@ class PrefetchIteratorTest extends \PHPUnit_Framework_TestCase
$this
->
plugin
->
initPlugin
(
$mockClient
,
array
());
$this
->
plugin
->
setQuery
(
$this
->
query
);
$this
->
assert
Equals
(
5
,
count
(
$this
->
plugin
)
);
$this
->
assert
Count
(
5
,
$this
->
plugin
);
}
public
function
testIteratorAndRewind
()
...
...
@@ -200,7 +200,7 @@ class PrefetchIteratorTest extends \PHPUnit_Framework_TestCase
$this
->
plugin
->
initPlugin
(
$mockClient
,
array
());
$this
->
plugin
->
setQuery
(
$this
->
query
)
->
setEndpoint
(
's2'
);
$this
->
assert
Equals
(
5
,
count
(
$this
->
plugin
)
);
$this
->
assert
Count
(
5
,
$this
->
plugin
);
}
public
function
testWithSpecificEndpointOption
()
...
...
@@ -214,7 +214,7 @@ class PrefetchIteratorTest extends \PHPUnit_Framework_TestCase
$this
->
plugin
->
initPlugin
(
$mockClient
,
array
(
'endpoint'
=>
's3'
));
$this
->
plugin
->
setQuery
(
$this
->
query
);
$this
->
assert
Equals
(
5
,
count
(
$this
->
plugin
)
);
$this
->
assert
Count
(
5
,
$this
->
plugin
);
}
}
...
...
tests/Solarium/Tests/QueryType/MoreLikeThis/QueryTest.php
View file @
a2ea6900
...
...
@@ -467,7 +467,7 @@ class QueryTest extends \PHPUnit_Framework_TestCase
);
$components
=
$query
->
getComponents
();
$this
->
assert
Equals
(
1
,
count
(
$components
)
);
$this
->
assert
Count
(
1
,
$components
);
$this
->
assertThat
(
array_pop
(
$components
),
$this
->
isInstanceOf
(
'Solarium\QueryType\Select\Query\Component\FacetSet'
)
...
...
tests/Solarium/Tests/QueryType/Select/Query/AbstractQueryTest.php
View file @
a2ea6900
...
...
@@ -470,7 +470,7 @@ abstract class AbstractQueryTest extends \PHPUnit_Framework_TestCase
);
$components
=
$query
->
getComponents
();
$this
->
assert
Equals
(
1
,
count
(
$components
)
);
$this
->
assert
Count
(
1
,
$components
);
$this
->
assertThat
(
array_pop
(
$components
),
$this
->
isInstanceOf
(
'Solarium\QueryType\Select\Query\Component\FacetSet'
)
...
...
tests/Solarium/Tests/QueryType/Select/Query/Component/DistributedSearchTest.php
View file @
a2ea6900
...
...
@@ -138,7 +138,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
$this
->
distributedSearch
->
clearShards
();
$shards
=
$this
->
distributedSearch
->
getShards
();
$this
->
assertTrue
(
is_array
(
$shards
));
$this
->
assert
Equals
(
0
,
count
(
$shards
)
);
$this
->
assert
Count
(
0
,
$shards
);
}
public
function
testAddShards
()
...
...
@@ -167,7 +167,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
)
);
$shards
=
$this
->
distributedSearch
->
getShards
();
$this
->
assert
Equals
(
3
,
count
(
$shards
)
);
$this
->
assert
Count
(
3
,
$shards
);
$this
->
assertEquals
(
array
(
'shard3'
=>
'localhost:8983/solr/shard3'
,
...
...
@@ -216,7 +216,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
$this
->
distributedSearch
->
clearCollections
();
$collections
=
$this
->
distributedSearch
->
getCollections
();
$this
->
assertTrue
(
is_array
(
$collections
));
$this
->
assert
Equals
(
0
,
count
(
$collections
)
);
$this
->
assert
Count
(
0
,
$collections
);
}
public
function
testAddCollections
()
...
...
@@ -245,7 +245,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
)
);
$collections
=
$this
->
distributedSearch
->
getCollections
();
$this
->
assert
Equals
(
3
,
count
(
$collections
)
);
$this
->
assert
Count
(
3
,
$collections
);
$this
->
assertEquals
(
array
(
'collection3'
=>
'localhost:8983/solr/collection3'
,
...
...
@@ -285,7 +285,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
$this
->
distributedSearch
->
clearReplicas
();
$replicas
=
$this
->
distributedSearch
->
getReplicas
();
$this
->
assertTrue
(
is_array
(
$replicas
));
$this
->
assert
Equals
(
0
,
count
(
$replicas
)
);
$this
->
assert
Count
(
0
,
$replicas
);
}
public
function
testAddReplicas
()
...
...
@@ -314,7 +314,7 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
)
);
$replicas
=
$this
->
distributedSearch
->
getReplicas
();
$this
->
assert
Equals
(
3
,
count
(
$replicas
)
);
$this
->
assert
Count
(
3
,
$replicas
);
$this
->
assertEquals
(
array
(
'replica3'
=>
'localhost:8983/solr/replica3'
,
...
...
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/DebugTest.php
View file @
a2ea6900
...
...
@@ -124,7 +124,7 @@ class DebugTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
'dummy-qp'
,
$result
->
getQueryParser
());
$this
->
assertEquals
(
'dummy-oq'
,
$result
->
getOtherQuery
());
$this
->
assert
Equals
(
1
,
count
(
$result
->
getExplain
()
));
$this
->
assert
Count
(
1
,
$result
->
getExplain
(
));
$doc
=
$result
->
getExplain
()
->
getDocument
(
'MA147LL/A'
);
$this
->
assertEquals
(
0.5
,
$doc
->
getValue
());
$this
->
assertEquals
(
true
,
$doc
->
getMatch
());
...
...
@@ -146,7 +146,7 @@ class DebugTest extends \PHPUnit_Framework_TestCase
)
);
$this
->
assertEquals
(
array
(
$expectedDetail
),
$doc
->
getDetails
());
$this
->
assert
Equals
(
1
,
count
(
$result
->
getExplainOther
()
));
$this
->
assert
Count
(
1
,
$result
->
getExplainOther
(
));
$doc
=
$result
->
getExplainOther
()
->
getDocument
(
'IW-02'
);
$this
->
assertEquals
(
0.6
,
$doc
->
getValue
());
$this
->
assertEquals
(
true
,
$doc
->
getMatch
());
...
...
@@ -158,10 +158,10 @@ class DebugTest extends \PHPUnit_Framework_TestCase
$timing
=
$result
->
getTiming
();
$this
->
assertEquals
(
36
,
$timing
->
getTime
());
$this
->
assert
Equals
(
2
,
count
(
$timing
->
getPhases
()
));
$this
->
assert
Count
(
2
,
$timing
->
getPhases
(
));
$phase
=
$timing
->
getPhase
(
'process'
);
$this
->
assertEquals
(
8
,
$phase
->
getTime
());
$this
->
assert
Equals
(
2
,
count
(
$phase
->
getTimings
()
));
$this
->
assert
Count
(
2
,
$phase
->
getTimings
(
));
$this
->
assertEquals
(
5
,
$phase
->
getTiming
(
'org.apache.solr.handler.component.QueryComponent'
));
$this
->
assertEquals
(
3
,
$phase
->
getTiming
(
'org.apache.solr.handler.component.MoreLikeThisComponent'
));
}
...
...
@@ -183,8 +183,8 @@ class DebugTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
'dummy-qp'
,
$result
->
getQueryParser
());
$this
->
assertEquals
(
'dummy-oq'
,
$result
->
getOtherQuery
());
$this
->
assert
Equals
(
0
,
count
(
$result
->
getExplain
()
));
$this
->
assert
Equals
(
0
,
count
(
$result
->
getExplainOther
()
));
$this
->
assert
Count
(
0
,
$result
->
getExplain
(
));
$this
->
assert
Count
(
0
,
$result
->
getExplainOther
(
));
}
public
function
testParseNoData
()
...
...
tests/Solarium/Tests/QueryType/Select/ResponseParser/Component/StatsTest.php
View file @
a2ea6900
...
...
@@ -76,6 +76,6 @@ class StatsTest extends \PHPUnit_Framework_TestCase
public
function
testParseNoData
()
{
$result
=
$this
->
parser
->
parse
(
null
,
null
,
array
());
$this
->
assert
Equals
(
0
,
count
(
$result
)
);
$this
->
assert
Count
(
0
,
$result
);
}
}
tests/Solarium/Tests/QueryType/Select/Result/AbstractDocumentTest.php
View file @
a2ea6900
...
...
@@ -73,13 +73,8 @@ abstract class AbstractDocumentTest extends \PHPUnit_Framework_TestCase
public
function
testPropertyEmpty
()
{
$this
->
assertTrue
(
empty
(
$this
->
doc
->
empty_field
)
);
$this
->
assertFalse
(
empty
(
$this
->
doc
->
categories
)
);
$this
->
assertEmpty
(
$this
->
doc
->
empty_field
);
$this
->
assertNotEmpty
(
$this
->
doc
->
categories
);
}
public
function
testSetField
()
...
...
@@ -124,13 +119,8 @@ abstract class AbstractDocumentTest extends \PHPUnit_Framework_TestCase
public
function
testArrayEmpty
()
{
$this
->
assertTrue
(
empty
(
$this
->
doc
[
'empty_field'
])
);
$this
->
assertFalse
(
empty
(
$this
->
doc
[
'categories'
])
);
$this
->
assertEmpty
(
$this
->
doc
[
'empty_field'
]);
$this
->
assertNotEmpty
(
$this
->
doc
[
'categories'
]);
}
public
function
testArraySet
()
...
...
tests/Solarium/Tests/QueryType/Terms/ResponseParserTest.php
View file @
a2ea6900
...
...
@@ -85,7 +85,7 @@ class ResponseParserTest extends \PHPUnit_Framework_TestCase
);
$this
->
assertEquals
(
$expected
,
$result
[
'results'
]);
$this
->
assert
Equals
(
2
,
count
(
$result
[
'results'
])
);
$this
->
assert
Count
(
2
,
$result
[
'results'
]
);
}
public
function
testParseSolr14Format
()
...
...
@@ -139,6 +139,6 @@ class ResponseParserTest extends \PHPUnit_Framework_TestCase
);
$this
->
assertEquals
(
$expected
,
$result
[
'results'
]);
$this
->
assert
Equals
(
2
,
count
(
$result
[
'results'
])
);
$this
->
assert
Count
(
2
,
$result
[
'results'
]
);
}
}
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