Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Stache/Stache.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ public function registerStores($stores)
return $this;
}

public function removeStore(string $store)
{
$this->stores->forget($store);

return $this;
}

public function stores()
{
return $this->stores;
Expand Down
18 changes: 18 additions & 0 deletions tests/Stache/StacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,24 @@ public function stores_can_be_registered()
});
}

#[Test]
public function stores_can_be_removed()
{
$this->stache->sites(['en']); // store expects the stache to have site(s)
$this->assertTrue($this->stache->stores()->isEmpty());

$this->stache->registerStore(
new CollectionsStore($this->stache, \Mockery::mock(Filesystem::class))
);

$return = $this->stache->removeStore('collections');

$this->assertEquals($this->stache, $return);
tap($this->stache->stores(), function ($stores) {
$this->assertEquals(0, $stores->count());
});
}

#[Test]
public function multiple_stores_can_be_registered_at_once()
{
Expand Down