diff --git a/src/Extend/Addon.php b/src/Extend/Addon.php index bc5d3e8cda..94fd2b5554 100644 --- a/src/Extend/Addon.php +++ b/src/Extend/Addon.php @@ -402,7 +402,7 @@ public function __call($method, $args) } /** - * The directory the package is located within. eg. "/path/to/vendor/statamic/bloodhound". + * The directory the package is located within. eg. "/path/to/vendor/statamic/bloodhound/". * * @return string */ @@ -420,7 +420,7 @@ public function directory() $dir = Str::removeRight(dirname($reflector->getFileName()), rtrim($this->autoload, '/')); - return $this->directory = Str::removeRight($dir, '/'); + return $this->directory = Str::ensureRight($dir, '/'); } public function existsOnMarketplace() diff --git a/tests/Extend/AddonTest.php b/tests/Extend/AddonTest.php index 9fa4cb3dde..dbaaf41664 100644 --- a/tests/Extend/AddonTest.php +++ b/tests/Extend/AddonTest.php @@ -16,7 +16,7 @@ class AddonTest extends TestCase public function setUp(): void { parent::setUp(); - $this->addonFixtureDir = realpath(__DIR__.'/../Fixtures/Addon'); + $this->addonFixtureDir = realpath(__DIR__.'/../Fixtures/Addon').'/'; } /** @test */ @@ -123,8 +123,8 @@ public function it_checks_if_a_file_exists() { $addon = $this->makeFromPackage(); - File::shouldReceive('exists')->with($this->addonFixtureDir.'/test.txt')->andReturnTrue(); - File::shouldReceive('exists')->with($this->addonFixtureDir.'/notfound.txt')->andReturnFalse(); + File::shouldReceive('exists')->with($this->addonFixtureDir.'test.txt')->andReturnTrue(); + File::shouldReceive('exists')->with($this->addonFixtureDir.'notfound.txt')->andReturnFalse(); $this->assertTrue($addon->hasFile('test.txt')); $this->assertFalse($addon->hasFile('notfound.txt')); @@ -135,7 +135,7 @@ public function it_gets_file_contents() { $addon = $this->makeFromPackage(); - File::shouldReceive('get')->with($this->addonFixtureDir.'/test.txt')->andReturn('the file contents'); + File::shouldReceive('get')->with($this->addonFixtureDir.'test.txt')->andReturn('the file contents'); $this->assertEquals('the file contents', $addon->getFile('test.txt')); } @@ -145,7 +145,7 @@ public function it_writes_file_contents() { $addon = $this->makeFromPackage(); - File::shouldReceive('put')->with($this->addonFixtureDir.'/test.txt', 'the file contents'); + File::shouldReceive('put')->with($this->addonFixtureDir.'test.txt', 'the file contents'); $addon->putFile('test.txt', 'the file contents'); }