Commit 1e011d9c authored by Markus Kalkbrenner's avatar Markus Kalkbrenner Committed by GitHub

run real Solr integration tests on travis (#537)

* run solr on travis

* use java 9

* fixed matrix

* added a first intergration test that select a result from the Solr techproducts example server

* added comment and dummy assertion to testPing()
parent 52930fff
......@@ -10,19 +10,26 @@ php:
- nightly
env:
- SYMFONY_VERSION=2.3.*
- SYMFONY_VERSION=2.7.*
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION=3.0.* # Does not work with php below 5.5
- SYMFONY_VERSION=4.0.*
# - SYMFONY_VERSION=2.3.* SOLR_VERSION=6.6.1
# - SYMFONY_VERSION=2.7.* SOLR_VERSION=6.6.1
- SYMFONY_VERSION=2.8.* SOLR_VERSION=6.6.2
- SYMFONY_VERSION=3.0.* SOLR_VERSION=6.6.2
- SYMFONY_VERSION=4.0.* SOLR_VERSION=6.6.2
- SYMFONY_VERSION=4.0.* SOLR_VERSION=7.2.0
cache:
directories:
- $HOME/.composer/cache
before_install:
- composer global require "hirak/prestissimo:^0.3"
- curl -O http://archive.apache.org/dist/lucene/solr/${SOLR_VERSION}/solr-${SOLR_VERSION}.tgz
- tar -xzf solr-${SOLR_VERSION}.tgz
before_script:
# - pecl install pecl_http
- composer require --prefer-source --dev symfony/event-dispatcher:${SYMFONY_VERSION}
- solr-${SOLR_VERSION}/bin/solr start -e techproducts
script: vendor/bin/phpunit -c phpunit.xml.travis -v
......@@ -32,15 +39,18 @@ after_success:
matrix:
exclude:
- php: 7.0
env: SYMFONY_VERSION=4.0.*
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=6.6.2
- php: 7.0
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=7.2.0
- php: 5.6
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=6.6.2
- php: 5.6
env: SYMFONY_VERSION=4.0.*
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=7.2.0
- php: hhvm
env: SYMFONY_VERSION=4.0.*
- php: nightly
env: SYMFONY_VERSION=4.0.*
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=6.6.2
- php: hhvm
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=7.2.0
allow_failures:
# - php: 5.3
- php: nightly
sudo: false
......@@ -46,7 +46,7 @@ use Solarium\Core\Query\Result\Result as BaseResult;
* Ping query result.
*
* A ping query has no useful result so only a dummy status var is available.
* If you don't get an exception for a ping query it was succesful.
* If you don't get an exception for a ping query it was successful.
*/
class Result extends BaseResult
{
......@@ -54,7 +54,7 @@ class Result extends BaseResult
* Get Solr status code.
*
* Since no status is returned for a ping, a default of 0 is used.
* If you don't get an exception for a ping query it was succesful.
* If you don't get an exception for a ping query it was successful.
*
* @return int
*/
......
<?php
namespace Solarium\Tests\Integration;
use Solarium\Core\Client\ClientInterface;
class TechproductsTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ClientInterface
*/
protected $client;
public function setUp()
{
$config = [
'endpoint' => [
'localhost' => [
'host' => '127.0.0.1',
'port' => 8983,
'path' => '/solr/',
'core' => 'techproducts',
]
]
];
$this->client = new \Solarium\Client($config);
}
/**
* The ping test succeeds if no exception is thrown.
*/
public function testPing()
{
$ping = $this->client->createPing();
$result = $this->client->ping($ping);
$this->assertEquals(0, $result->getStatus());
}
public function testSelect()
{
$select = $this->client->createSelect();
$select->setSorts(['id' => 'asc']);
$result = $this->client->select($select);
$this->assertEquals(32, $result->getNumFound());
$this->assertEquals(10, $result->count());
$ids = [];
/** @var \Solarium\QueryType\Select\Result\Document $document */
foreach ($result as $document) {
$ids[] = $document->id;
}
$this->assertEquals([
"0579B002",
"100-435805",
"3007WFP",
"6H500F0",
"9885A004",
"EN7800GTX/2DHTV/256M",
"EUR",
"F8V7067-APL-KIT",
"GB18030TEST",
"GBP",
], $ids);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment