Skip to content

Commit

Permalink
Hooked up Travis and Coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
gigablah committed Aug 22, 2013
1 parent ca478ba commit 342f084
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 43 deletions.
4 changes: 4 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# for php-coveralls
service_name: travis-ci
src_dir: src
coverage_clover: build/logs/clover.xml
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ Icon?
ehthumbs.db
Thumbs.db
/vendor
/composer.lock
composer.lock
composer.phar
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
language: php

php:
- 5.3
- 5.4
- 5.5

before_install:
- wget http://sphinxsearch.com/files/sphinx-2.0.6-release.tar.gz
- tar xzf sphinx-2.0.6-release.tar.gz
- cd sphinx-2.0.6-release
- wget http://snowball.tartarus.org/dist/libstemmer_c.tgz
- tar xzf libstemmer_c.tgz
- ./configure --prefix=/usr/local/sphinx --with-libstemmer --with-iconv --with-mysql --enable-id64 --quiet
- make -j --quiet
- sudo make install
- cd ..

before_script:
- mysql -e "CREATE DATABASE IF NOT EXISTS sphinx;"
- mysql -e "SOURCE `pwd`/tests/Sphinx/Tests/Fixtures/sphinxtest.sql"
- sudo /usr/local/sphinx/bin/indexer -c tests/Sphinx/Tests/Fixtures/sphinxtest.conf --all
- sudo /usr/local/sphinx/bin/searchd -c tests/Sphinx/Tests/Fixtures/sphinxtest.conf
- composer self-update
- composer install --prefer-source --no-interaction --dev

script:
- mkdir -p build/logs
- phpunit

after_script:
- php vendor/bin/coveralls -v
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
"phpunit/phpunit": "3.7.*",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-0": {
"Sphinx": "src"
}
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
}
}
}
13 changes: 11 additions & 2 deletions phpunit.xml → phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@
strict="true">
<testsuites>
<testsuite name="SphinxClient Test Suite">
<directory>./tests/Sphinx/</directory>
<directory>./tests/Sphinx</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src</directory>
<exclude>
<directory>./build</directory>
<directory>./vendor</directory>
<directory>./tests</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
</phpunit>
68 changes: 34 additions & 34 deletions tests/Sphinx/Tests/Fixtures/sphinxtest.conf
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
source sphinxtest_src
{
type = mysql
sql_host = 127.0.0.1
sql_user = root
sql_pass =
sql_db = test
sql_port = 3306
sql_query_pre = SET CHARACTER_SET_RESULTS=utf8
sql_query_pre = SET NAMES utf8
sql_query = SELECT * FROM sphinxtest
sql_attr_uint = attr1
sql_attr_float = lat
sql_attr_float = long
sql_attr_string = stringattr
sql_query_info = SELECT * FROM sphinxtest WHERE id=$id
}
index sphinxtest
{
source = sphinxtest_src
path = ./data/sphinxtest
html_strip = 0
min_word_len = 1
charset_type = utf-8
charset_table = 0..9, a..z, A..Z->a..z, U+3041->U+30A2, U+3042->U+30A2, U+3043->U+30A4, U+3044->U+30A4, U+3045->U+30A6, U+3046->U+30A6, U+3047->U+30A8, U+3048->U+30A8, U+3049->U+30AA, U+304A->U+30AA, U+304B..U+3062->U+30AB..U+30C2, U+3063->U+30C4, U+3064..U+3082->U+30C4..U+30E2, U+3083->U+30E4, U+3084->U+30E4, U+3085->U+30E6, U+3086->U+30E6, U+3087->U+30E8, U+3088->U+30E8, U+3089..U+308D->U+30E9..U+30ED, U+308E->U+30EF, U+308F..U+3094->U+30EF..U+30F4, U+3095->U+30AB, U+3096->U+30B1, U+309F->U+30FF, U+30A1->U+30A2, U+30A2, U+30A3->U+30A4, U+30A4, U+30A5->U+30A6, U+30A6, U+30A7->U+30A8, U+30A8, U+30A9->U+30AA, U+30AA, U+30AB..U+30C2, U+30C3->U+30C4, U+30C4..U+30E2, U+30E3->U+30E4, U+30E4, U+30E5->U+30E6, U+30E6, U+30E7->U+30E8, U+30E8..U+30ED, U+30EE->U+30EF, U+30EF..U+30F4, U+30F5->U+30AB, U+30F6->U+30B1, U+30FA, U+30FF, U+31F0->U+30AF, U+31F1->U+30B7, U+31F2->U+30B9, U+31F3->U+30C8, U+31F4->U+30CC, U+31F5->U+30CF, U+31F6->U+30D2, U+31F7->U+30D5, U+31F8->U+30D8, U+31F9->U+30DB, U+31FA->U+30E0, U+31FB..U+31FF->U+30E9..U+30ED, U+3400..U+4DB5, U+4E00..U+9FC3, U+F900..U+FAD9, U+FF10..U+FF19->0..9, U+FF21..U+FF3A->a..z, U+FF41..U+FF5A->a..z, U+FF66->U+30F2, U+FF67->U+30A2, U+FF68->U+30A4, U+FF69->U+30A6, U+FF6A->U+30A8, U+FF6B->U+30AA, U+FF6C->U+30E4, U+FF6D->U+30E6, U+FF6E->U+30E8, U+FF6F->U+30C4, U+FF71->U+30A2, U+FF72->U+30A4, U+FF73->U+30A6, U+FF74->U+30A8, U+FF75->U+30AA, U+FF76->U+30AD, U+FF78->U+30AF, U+FF79->U+30B1, U+FF7A->U+30B3, U+FF7B->U+30B5, U+FF7C->U+30B7, U+FF7D->U+30B9, U+FF7E->U+30BB, U+FF7F->U+30BD, U+FF80->U+30BF, U+FF81->U+30C1, U+FF82->U+30C4, U+FF83->U+30C6, U+FF84->U+30C8, U+FF85..U+FF8A->U+30CA..U+30CF, U+FF8B->U+30D2, U+FF8C->U+30D5, U+FF8D->U+30D8, U+FF8E->U+30DB, U+FF8F..U+FF93->U+30DE..U+30E2, U+FF94->U+30E4, U+FF95->U+30E6, U+FF96..U+FF9B->U+30E8..U+30ED, U+FF9C->U+30EF, U+FF9D->U+30F3, U+20000..U+2A6D6, U+2F800..U+2FA1D
}
searchd
{
listen = 9312
log = ./log/searchd.log
query_log = ./log/query.log
pid_file = ./log/searchd.pid
source sphinxtest_src
{
type = mysql
sql_host = 127.0.0.1
sql_user = travis
sql_pass =
sql_db = sphinx
sql_port = 3306
sql_query_pre = SET CHARACTER_SET_RESULTS=utf8
sql_query_pre = SET NAMES utf8
sql_query = SELECT * FROM sphinxtest
sql_attr_uint = attr1
sql_attr_float = lat
sql_attr_float = long
sql_attr_string = stringattr
sql_query_info = SELECT * FROM sphinxtest WHERE id=$id
}

index sphinxtest
{
source = sphinxtest_src
path = /etc/sphinxtest
html_strip = 0
min_word_len = 1
charset_type = utf-8
charset_table = 0..9, a..z, A..Z->a..z, U+3041->U+30A2, U+3042->U+30A2, U+3043->U+30A4, U+3044->U+30A4, U+3045->U+30A6, U+3046->U+30A6, U+3047->U+30A8, U+3048->U+30A8, U+3049->U+30AA, U+304A->U+30AA, U+304B..U+3062->U+30AB..U+30C2, U+3063->U+30C4, U+3064..U+3082->U+30C4..U+30E2, U+3083->U+30E4, U+3084->U+30E4, U+3085->U+30E6, U+3086->U+30E6, U+3087->U+30E8, U+3088->U+30E8, U+3089..U+308D->U+30E9..U+30ED, U+308E->U+30EF, U+308F..U+3094->U+30EF..U+30F4, U+3095->U+30AB, U+3096->U+30B1, U+309F->U+30FF, U+30A1->U+30A2, U+30A2, U+30A3->U+30A4, U+30A4, U+30A5->U+30A6, U+30A6, U+30A7->U+30A8, U+30A8, U+30A9->U+30AA, U+30AA, U+30AB..U+30C2, U+30C3->U+30C4, U+30C4..U+30E2, U+30E3->U+30E4, U+30E4, U+30E5->U+30E6, U+30E6, U+30E7->U+30E8, U+30E8..U+30ED, U+30EE->U+30EF, U+30EF..U+30F4, U+30F5->U+30AB, U+30F6->U+30B1, U+30FA, U+30FF, U+31F0->U+30AF, U+31F1->U+30B7, U+31F2->U+30B9, U+31F3->U+30C8, U+31F4->U+30CC, U+31F5->U+30CF, U+31F6->U+30D2, U+31F7->U+30D5, U+31F8->U+30D8, U+31F9->U+30DB, U+31FA->U+30E0, U+31FB..U+31FF->U+30E9..U+30ED, U+3400..U+4DB5, U+4E00..U+9FC3, U+F900..U+FAD9, U+FF10..U+FF19->0..9, U+FF21..U+FF3A->a..z, U+FF41..U+FF5A->a..z, U+FF66->U+30F2, U+FF67->U+30A2, U+FF68->U+30A4, U+FF69->U+30A6, U+FF6A->U+30A8, U+FF6B->U+30AA, U+FF6C->U+30E4, U+FF6D->U+30E6, U+FF6E->U+30E8, U+FF6F->U+30C4, U+FF71->U+30A2, U+FF72->U+30A4, U+FF73->U+30A6, U+FF74->U+30A8, U+FF75->U+30AA, U+FF76->U+30AD, U+FF78->U+30AF, U+FF79->U+30B1, U+FF7A->U+30B3, U+FF7B->U+30B5, U+FF7C->U+30B7, U+FF7D->U+30B9, U+FF7E->U+30BB, U+FF7F->U+30BD, U+FF80->U+30BF, U+FF81->U+30C1, U+FF82->U+30C4, U+FF83->U+30C6, U+FF84->U+30C8, U+FF85..U+FF8A->U+30CA..U+30CF, U+FF8B->U+30D2, U+FF8C->U+30D5, U+FF8D->U+30D8, U+FF8E->U+30DB, U+FF8F..U+FF93->U+30DE..U+30E2, U+FF94->U+30E4, U+FF95->U+30E6, U+FF96..U+FF9B->U+30E8..U+30ED, U+FF9C->U+30EF, U+FF9D->U+30F3, U+20000..U+2A6D6, U+2F800..U+2FA1D
}

searchd
{
listen = 9312
log = /etc/searchd.log
query_log = /etc/query.log
pid_file = /etc/searchd.pid
}
6 changes: 3 additions & 3 deletions tests/Sphinx/Tests/Fixtures/sphinxtest.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SET NAMES utf8;

DROP TABLE IF EXISTS `test`.`sphinxtest`;
DROP TABLE IF EXISTS `sphinx`.`sphinxtest`;

CREATE TABLE `test`.`sphinxtest` (
CREATE TABLE `sphinx`.`sphinxtest` (
`id` BIGINT UNSIGNED NOT NULL auto_increment,
`field1` TEXT,
`field2` TEXT,
Expand All @@ -12,7 +12,7 @@ CREATE TABLE `test`.`sphinxtest` (
`stringattr` VARCHAR(100),
PRIMARY KEY (`id`)) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

INSERT INTO `test`.`sphinxtest` (`id`,`field1`,`field2`,`attr1`,`lat`,`long`,`stringattr`) VALUES
INSERT INTO `sphinx`.`sphinxtest` (`id`,`field1`,`field2`,`attr1`,`lat`,`long`,`stringattr`) VALUES
(1, 'a', 'bb', 2, 0.35, 0.70, ''),
(2, 'a', 'bb ccc', 4, 0.70, 0.35, ''),
(3, 'a', 'bb ccc dddd', 1, 0.35, 0.70, ''),
Expand Down
1 change: 0 additions & 1 deletion tests/Sphinx/Tests/SphinxClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,6 @@ public function testEscapeString()
public function testQuery($query, $sphinx, $expected)
{
$results = $sphinx->query($query);
//print_r($results);
foreach ($expected as $key => $value) {
if ($key === 'matches') {
$this->assertEquals(array_keys($results['matches']), $value);
Expand Down

0 comments on commit 342f084

Please sign in to comment.