-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing unit tests #76
Open
pkamps
wants to merge
16
commits into
ezsystems:master
Choose a base branch
from
pkamps:fixing_unit_test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e0933de
Fixing fatal errors in unit tests. Fixing most failing tests - some t…
pkamps fc0f3da
Adding tests to check for the correct SearchCount
pkamps 04f339c
debug code removed
pkamps 183e1f3
Fix EZP-21331: fatal error due to invalid facet def passed to fetch f…
yannickroger 4731cf3
Implement EZP-21380: 'highlighting' as a SearchExtras attribute
0ecde9b
Implement EZP-21404: Allow excluding object owner/author from search
99ef4c5
EZP-21779: Removed duplicate table creation
130bda1
Merge pull request #131 from jeromegamez/EZP-21779_duplicate_sql_data
andrerom 34730ce
Merge pull request #116 from joaoinacio/searchextras_highlight
andrerom 8a8fadb
Merge pull request #117 from joaoinacio/EZP-21404
andrerom d333cbf
Merge pull request #115 from gggeek/EZP-21331
andrerom f9e479b
Merge pull request #177 from ezsystems/EZP-23407-mark-elevated-results
andrerom 2b552e7
Fixing fatal errors in unit tests. Fixing most failing tests - some t…
pkamps 70004a5
Adding tests to check for the correct SearchCount
pkamps d514ba3
debug code removed
pkamps b67ec2c
Rebased
pkamps File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?php | ||
/** | ||
* File containing eZFindFetchRegression class | ||
* | ||
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved. | ||
* @license http://ez.no/licenses/gnu_gpl GNU GPLv2 | ||
* @package ezfind | ||
*/ | ||
class eZFindFetch extends ezFindTestCase | ||
{ | ||
protected $fetchParams; | ||
|
||
/** | ||
* @var eZContentObject | ||
*/ | ||
protected $testObj; | ||
|
||
/** | ||
* @var eZSolr | ||
*/ | ||
protected $solrSearch; | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
eZINI::instance( 'ezfind.ini' )->loadCache( true ); | ||
eZINI::instance( 'solr.ini' )->loadCache( true ); | ||
ezpINIHelper::setINISetting( 'site.ini', 'SearchSettings', 'AllowEmptySearch', 'enabled' ); | ||
ezpINIHelper::setINISetting( 'site.ini', 'RegionalSettings', 'SiteLanguageList', array( 'eng-GB' ) ); | ||
$this->solrSearch = new eZSolr(); | ||
$this->testObj = eZContentObject::fetchByNodeID( 2 ); | ||
$this->solrSearch->addObject( $this->testObj ); | ||
|
||
$this->fetchParams = array( | ||
'SearchOffset' => 0, | ||
'SearchLimit' => 10, | ||
'Facet' => null, | ||
'SortBy' => null, | ||
'Filter' => null, | ||
'SearchContentClassID' => null, | ||
'SearchSectionID' => null, | ||
'SearchSubTreeArray' => null, | ||
'AsObjects' => null, | ||
'SpellCheck' => null, | ||
'IgnoreVisibility' => null, | ||
'Limitation' => null, | ||
'BoostFunctions' => null, | ||
'QueryHandler' => 'ezpublish', | ||
'EnableElevation' => null, | ||
'ForceElevation' => null, | ||
'SearchDate' => null, | ||
'DistributedSearch' => null, | ||
'FieldsToReturn' => null | ||
); | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
$this->solrSearch->removeObject( $this->testObj ); | ||
ezpINIHelper::restoreINISettings(); | ||
parent::tearDown(); | ||
} | ||
|
||
/** | ||
*/ | ||
public function testSearch() | ||
{ | ||
$res = $this->solrSearch->search( '', array( 'Filter' => 'meta_node_id_si:2' ) ); | ||
|
||
self::assertInternalType( PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $res['SearchResult'] ); | ||
self::assertCount( 1, $res[ 'SearchResult' ] ); | ||
self::assertEquals( 1, $res[ 'SearchCount' ] ); | ||
|
||
$rootNode = $res['SearchResult'][0]; | ||
|
||
self::assertTrue( $rootNode instanceof eZFindResultNode ); | ||
} | ||
|
||
public function testNonObjectSearch() | ||
{ | ||
$res = $this->solrSearch->search( '', array( 'Filter' => 'meta_node_id_si:2', | ||
'AsObjects' => false ) ); | ||
|
||
self::assertInternalType( PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $res['SearchResult'] ); | ||
self::assertCount( 1, $res[ 'SearchResult' ] ); | ||
self::assertEquals( 1, $res[ 'SearchCount' ] ); | ||
self::assertTrue( $res['SearchResult'][0][ 'main_node_id' ] == 2 ); | ||
} | ||
|
||
public function testMoreLikeThis() | ||
{ | ||
$res = $this->solrSearch->moreLikeThis( 'text', 'ez publish' ); | ||
|
||
self::assertInternalType( PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $res['SearchResult'] ); | ||
self::assertCount( 1, $res[ 'SearchResult' ] ); | ||
self::assertEquals( 1, $res[ 'SearchCount' ] ); | ||
|
||
$rootNode = $res['SearchResult'][0]; | ||
|
||
self::assertTrue( $rootNode instanceof eZFindResultNode ); | ||
} | ||
|
||
public function testNonObjectMoreLikeThis() | ||
{ | ||
$res = $this->solrSearch->moreLikeThis( 'text', 'ez publish', array( 'AsObjects' => false ) ); | ||
|
||
self::assertInternalType( PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $res['SearchResult'] ); | ||
self::assertCount( 1, $res[ 'SearchResult' ] ); | ||
self::assertEquals( 1, $res[ 'SearchCount' ] ); | ||
|
||
self::assertTrue( $res['SearchResult'][0][ 'main_node_id' ] == 2 ); | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
class ezFindTestCase extends ezpDatabaseTestCase | ||
{ | ||
/* | ||
* SharedFixture == db connection (strange name?) | ||
* | ||
* Lazy init | ||
*/ | ||
protected function getSharedFixture() | ||
{ | ||
if( !$this->sharedFixture ) | ||
{ | ||
$dsn = ezpTestRunner::dsn(); | ||
$this->sharedFixture = ezpDatabaseHelper::useDatabase( $dsn ); | ||
} | ||
|
||
return $this->sharedFixture; | ||
} | ||
} | ||
|
||
?> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this and we are ready to go :)