Skip to content

Commit

Permalink
tests works now also some readme
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriVesala committed Jun 18, 2012
1 parent 1811dba commit 2f66949
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
nbproject
/Tests/vendor/.composer/
/Tests/vendor
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,49 @@ kind of data to expect.
You can use XiSearchBundle with any searchengine as XiSearchBundle provides you interfaces that your
final search data object structure must implement.

## Installing

### deps -file
```
[XiSearchBundle]
git=http://github.com/xi-project/xi-bundle-search.git
target=/bundles/Xi/Bundle/SearchBundle
```

### autoload.php file
```php
<?php
'Xi\\Bundle' => __DIR__.'/../vendor/bundles',
?>
```

### appKernel.php -file
```php
<?php
new Xi\Bundle\SearchBundle\XiSearchBundle(),
?>
```

### routing.yml -file
```yml
XiSearchBundle:
resource: "@XiSearchBundle/Resources/config/routing.yml"
prefix: /
```

### extend ajaxForm (from ajaxbundle) and make sure you bind your custom class as your ajax form handler (see ajaxbundle documentation)

``` coffee
class App.AjaxForm.YourCustomClass extends App.AjaxForm.Default

xiSearchResultCallback: (content) ->
@searchResult = $(@element).siblings('.search-result')
if [email protected]
$(@element).after('<div class="search-result"></div>')
@searchResult = $(@element).siblings('.search-result')

@searchResult.html(content)
```

## Integration to ElasticSearch

Expand Down
16 changes: 16 additions & 0 deletions Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

if (!@include __DIR__ . '/vendor/autoload.php') {
die("You must set up the project dependencies, run the following commands:
wget http://getcomposer.org/composer.phar
php composer.phar install
");
}

spl_autoload_register(function($class) {
if (0 === strpos($class, 'Xi\Bundle\SearchBundle\\') &&
file_exists($file = __DIR__ . '/../' . implode('/', array_slice(explode('\\', $class), 3)) . '.php')
) {
require_once $file;
}
});
8 changes: 8 additions & 0 deletions Tests/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"require": {
"symfony/framework-bundle": "=v2.0.14",
"symfony/form": "=v2.0.14",
"symfony/dependency-injection": "=v2.0.14",
"twig/twig": "1.*"
}
}
20 changes: 20 additions & 0 deletions Tests/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="bootstrap.php"
>
<testsuites>
<testsuite name="Xi FilelibBundle Test Suite">
<directory>.</directory>
<exclude>./vendor</exclude>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 2f66949

Please sign in to comment.