-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
293 additions
and
122 deletions.
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
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
File renamed without changes.
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,90 @@ | ||
Feature: Indexing | ||
In order to search for things | ||
As a developer | ||
I must first index them | ||
|
||
Background: | ||
Given the entity "Car" exists: | ||
""" | ||
<?php | ||
namespace Massive\Bundle\SearchBundle\Tests\Resources\TestBundle\Entity; | ||
class Car { | ||
public $id; | ||
public $title; | ||
public $body; | ||
public $numberOfWheels; | ||
public $cost; | ||
public $date; | ||
public $image; | ||
public $locale; | ||
} | ||
""" | ||
And I purge the index "car" | ||
|
||
Scenario: Basic indexing | ||
Given that the following mapping for "Car" exists: | ||
""" | ||
<massive-search-mapping xmlns="http://massiveart.com/schema/dic/massive-search-mapping"> | ||
<mapping class="Massive\Bundle\SearchBundle\Tests\Resources\TestBundle\Entity\Car"> | ||
<index name="car"/> | ||
<id property="id"/> | ||
<url expr="'foobar'" /> | ||
<title property="title" /> | ||
<description property="body" /> | ||
<category name="Car" /> | ||
<image property="image" /> | ||
<locale property="locale" /> | ||
<fields> | ||
<field name="title" expr="object.title" type="string" /> | ||
<field name="body" type="string" /> | ||
<field name="numberOfWheels" type="string" /> | ||
</fields> | ||
</mapping> | ||
</massive-search-mapping> | ||
""" | ||
When I index the following "Car" objects | ||
""" | ||
[ | ||
{ "id": 123, "url": "/url/to", "title": "My car", "body": "Hello", "image": "foo.jpg"}, | ||
{ "id": 321, "url": "/url/to", "title": "My car", "body": "Hello", "image": "foo.jpg"} | ||
] | ||
""" | ||
And I search for "My car" | ||
Then there should be 2 results | ||
|
||
Scenario: Invalid mapping, unknown field type | ||
Given that the following mapping for "Car" exists: | ||
""" | ||
<massive-search-mapping xmlns="http://massiveart.com/schema/dic/massive-search-mapping"> | ||
<mapping class="Massive\Bundle\SearchBundle\Tests\Resources\TestBundle\Entity\Car"> | ||
<index name="car"/> | ||
<id property="id"/> | ||
<url expr="'foobar'" /> | ||
<title property="title" /> | ||
<description property="body" /> | ||
<category name="Car" /> | ||
<image property="image" /> | ||
<locale property="locale" /> | ||
<fields> | ||
<field name="title" field="title" type="foobar" /> | ||
</fields> | ||
</mapping> | ||
</massive-search-mapping> | ||
""" | ||
When I index the following "Car" objects | ||
""" | ||
[ | ||
{ "id": 123, "url": "/url/to", "title": "My car", "body": "Hello", "image": "foo.jpg"}, | ||
{ "id": 321, "url": "/url/to", "title": "My car", "body": "Hello", "image": "foo.jpg"} | ||
] | ||
""" | ||
Then an exception with message 'Search field type "foobar" is not known.' should be thrown | ||
|
File renamed without changes.
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
Oops, something went wrong.