| @@ 16-29 (lines=14) @@ | ||
| 13 | /** |
|
| 14 | * An invalid directory should throw an Exception. |
|
| 15 | */ |
|
| 16 | public function testIndexException() |
|
| 17 | { |
|
| 18 | $indexer = new FileIndexer(); |
|
| 19 | $exceptionRaised = false; |
|
| 20 | ||
| 21 | try { |
|
| 22 | $indexer->index([ |
|
| 23 | __DIR__.'/assets' |
|
| 24 | ]); |
|
| 25 | } catch (Exception $exception) { |
|
| 26 | $exceptionRaised = true; |
|
| 27 | } |
|
| 28 | $this->assertTrue($exceptionRaised); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * The files in the given directory to index should be added to the index during indexing. |
|
| @@ 79-90 (lines=12) @@ | ||
| 76 | /** |
|
| 77 | * Adding a invalid file should throw an exception. |
|
| 78 | */ |
|
| 79 | public function testAddException() |
|
| 80 | { |
|
| 81 | $indexer = new FileIndexer(); |
|
| 82 | $exceptionRaised = false; |
|
| 83 | ||
| 84 | try { |
|
| 85 | $indexer->add(new SplFileInfo('/some_path/is_wrong')); |
|
| 86 | } catch (Exception $exception) { |
|
| 87 | $exceptionRaised = true; |
|
| 88 | } |
|
| 89 | $this->assertTrue($exceptionRaised); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * Adding a invalid file should throw an exception. |
|
| @@ 95-106 (lines=12) @@ | ||
| 92 | /** |
|
| 93 | * Adding a invalid file should throw an exception. |
|
| 94 | */ |
|
| 95 | public function testGetException() |
|
| 96 | { |
|
| 97 | $indexer = new FileIndexer(); |
|
| 98 | $exceptionRaised = false; |
|
| 99 | ||
| 100 | try { |
|
| 101 | $indexer->get('/some_path/is_wrong'); |
|
| 102 | } catch (Exception $exception) { |
|
| 103 | $exceptionRaised = true; |
|
| 104 | } |
|
| 105 | $this->assertTrue($exceptionRaised); |
|
| 106 | } |
|
| 107 | ||
| 108 | /** |
|
| 109 | * The reindex should only put in the change set the modified files. |
|