-
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
15 changed files
with
242 additions
and
108 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
File renamed without changes.
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,89 @@ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,8 @@ | ||
<?php | ||
|
||
namespace Massive\Bundle\SearchBundle\Tests\Resources\TestBundle\Entity; | ||
use Massive\Bundle\SearchBundle\Tests\Resources\TestBundle\Product as BaseProduct; | ||
|
||
class Product | ||
class Product extends BaseProduct | ||
{ | ||
public $id; | ||
public $title; | ||
public $body; | ||
public $date; | ||
public $url; | ||
public $locale; | ||
public $image; | ||
|
||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function setId($id) | ||
{ | ||
$this->id = $id; | ||
} | ||
|
||
public function getTitle() | ||
{ | ||
return $this->title; | ||
} | ||
|
||
public function setTitle($title) | ||
{ | ||
$this->title = $title; | ||
} | ||
|
||
public function getBody() | ||
{ | ||
return $this->body; | ||
} | ||
|
||
public function setBody($body) | ||
{ | ||
$this->body = $body; | ||
} | ||
|
||
public function getDate() | ||
{ | ||
return $this->date; | ||
} | ||
|
||
public function setDate($date) | ||
{ | ||
$this->date = $date; | ||
} | ||
|
||
public function getUrl() | ||
{ | ||
return $this->url; | ||
} | ||
|
||
public function setUrl($url) | ||
{ | ||
$this->url = $url; | ||
} | ||
|
||
public function getLocale() | ||
{ | ||
return $this->locale; | ||
} | ||
|
||
public function setLocale($locale) | ||
{ | ||
$this->locale = $locale; | ||
} | ||
|
||
public function getImage() | ||
{ | ||
return $this->image; | ||
} | ||
|
||
public function setImage($image) | ||
{ | ||
$this->image = $image; | ||
} | ||
} |
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,85 @@ | ||
<?php | ||
|
||
namespace Massive\Bundle\SearchBundle\Tests\Resources\TestBundle; | ||
|
||
class Product | ||
{ | ||
public $id; | ||
public $title; | ||
public $body; | ||
public $date; | ||
public $url; | ||
public $locale; | ||
public $image; | ||
|
||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function setId($id) | ||
{ | ||
$this->id = $id; | ||
} | ||
|
||
public function getTitle() | ||
{ | ||
return $this->title; | ||
} | ||
|
||
public function setTitle($title) | ||
{ | ||
$this->title = $title; | ||
} | ||
|
||
public function getBody() | ||
{ | ||
return $this->body; | ||
} | ||
|
||
public function setBody($body) | ||
{ | ||
$this->body = $body; | ||
} | ||
|
||
public function getDate() | ||
{ | ||
return $this->date; | ||
} | ||
|
||
public function setDate($date) | ||
{ | ||
$this->date = $date; | ||
} | ||
|
||
public function getUrl() | ||
{ | ||
return $this->url; | ||
} | ||
|
||
public function setUrl($url) | ||
{ | ||
$this->url = $url; | ||
} | ||
|
||
public function getLocale() | ||
{ | ||
return $this->locale; | ||
} | ||
|
||
public function setLocale($locale) | ||
{ | ||
$this->locale = $locale; | ||
} | ||
|
||
public function getImage() | ||
{ | ||
return $this->image; | ||
} | ||
|
||
public function setImage($image) | ||
{ | ||
$this->image = $image; | ||
} | ||
} | ||
|
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.