|
@@ 58-67 (lines=10) @@
|
| 55 |
|
/** |
| 56 |
|
* Tests that the locator is able to find the path to the currently executing plugin. |
| 57 |
|
*/ |
| 58 |
|
public function test_finds_current_plugin() { |
| 59 |
|
$this->path_processor->expects( $this->once() ) |
| 60 |
|
->method( 'find_directory_with_autoloader' ) |
| 61 |
|
->with( TEST_PLUGIN_DIR, array() ) |
| 62 |
|
->willReturn( TEST_PLUGIN_DIR ); |
| 63 |
|
|
| 64 |
|
$path = $this->locator->find_current_plugin(); |
| 65 |
|
|
| 66 |
|
$this->assertEquals( TEST_PLUGIN_DIR, $path ); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
/** |
| 70 |
|
* Tests that the locator throws an exception when the currently executing plugin is not an autoloaded plugin. |
|
@@ 72-81 (lines=10) @@
|
| 69 |
|
/** |
| 70 |
|
* Tests that the locator throws an exception when the currently executing plugin is not an autoloaded plugin. |
| 71 |
|
*/ |
| 72 |
|
public function test_finds_current_plugin_throws_exception_when_not_autoloaded() { |
| 73 |
|
$this->path_processor->expects( $this->once() ) |
| 74 |
|
->method( 'find_directory_with_autoloader' ) |
| 75 |
|
->with( TEST_PLUGIN_DIR, array() ) |
| 76 |
|
->willReturn( false ); |
| 77 |
|
|
| 78 |
|
$this->expectExceptionMessage( 'Failed to locate plugin' ); |
| 79 |
|
|
| 80 |
|
$this->locator->find_current_plugin(); |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
/** |
| 84 |
|
* Tests that guessing using option doesn't break when looking for plugins that don't exist. |