| @@ 21-27 (lines=7) @@ | ||
| 18 | { |
|
| 19 | public $container; |
|
| 20 | ||
| 21 | public function testIndexableUnknown() |
|
| 22 | { |
|
| 23 | $indexable = new Indexable(array(), $this->container); |
|
| 24 | $index = $indexable->isObjectIndexable('index', 'type', new Entity()); |
|
| 25 | ||
| 26 | $this->assertTrue($index); |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @dataProvider provideIsIndexableCallbacks |
|
| @@ 32-40 (lines=9) @@ | ||
| 29 | /** |
|
| 30 | * @dataProvider provideIsIndexableCallbacks |
|
| 31 | */ |
|
| 32 | public function testValidIndexableCallbacks($callback, $return) |
|
| 33 | { |
|
| 34 | $indexable = new Indexable(array( |
|
| 35 | 'index/type' => $callback, |
|
| 36 | ), $this->container); |
|
| 37 | $index = $indexable->isObjectIndexable('index', 'type', new Entity()); |
|
| 38 | ||
| 39 | $this->assertEquals($return, $index); |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @dataProvider provideInvalidIsIndexableCallbacks |
|
| @@ 46-52 (lines=7) @@ | ||
| 43 | * @dataProvider provideInvalidIsIndexableCallbacks |
|
| 44 | * @expectedException \InvalidArgumentException |
|
| 45 | */ |
|
| 46 | public function testInvalidIsIndexableCallbacks($callback) |
|
| 47 | { |
|
| 48 | $indexable = new Indexable(array( |
|
| 49 | 'index/type' => $callback, |
|
| 50 | ), $this->container); |
|
| 51 | $indexable->isObjectIndexable('index', 'type', new Entity()); |
|
| 52 | } |
|
| 53 | ||
| 54 | public function provideInvalidIsIndexableCallbacks() |
|
| 55 | { |
|
| @@ 65-72 (lines=8) @@ | ||
| 62 | ); |
|
| 63 | } |
|
| 64 | ||
| 65 | public function testObjectIsNotIndexableIfIndexingDisabled() |
|
| 66 | { |
|
| 67 | $indexable = new Indexable(array(), $this->container); |
|
| 68 | $indexable->setIndexingEnabled(false); |
|
| 69 | $index = $indexable->isObjectIndexable('index', 'type', new Entity()); |
|
| 70 | ||
| 71 | $this->assertFalse($index); |
|
| 72 | } |
|
| 73 | ||
| 74 | public function provideIsIndexableCallbacks() |
|
| 75 | { |
|