Skip to content

Commit

Permalink
Merge pull request #72 from TomHAnderson/hotfix/coverage-1
Browse files Browse the repository at this point in the history
Hotfix/coverage 1
  • Loading branch information
TomHAnderson authored Oct 29, 2024
2 parents 8ad0d8c + b42d360 commit 212c55c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
23 changes: 23 additions & 0 deletions tests/Feature/Sortable/SortableExtensionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\Extensions\Feature\Sortable;

use LaravelDoctrine\Extensions\Sortable\SortableExtension;
use LaravelDoctrineTest\Extensions\Feature\TestCase;

class SortableExtensionTest extends TestCase
{
public function testCanRegisterExtension(): void
{
$extension = new SortableExtension();

$extension->addSubscribers(
$this->evm,
$this->em,
);

$this->assertEmpty($extension->getFilters());
}
}
27 changes: 5 additions & 22 deletions tests/Feature/Translatable/TranslatableExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,19 @@

namespace LaravelDoctrineTest\Extensions\Feature\Translatable;

use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Foundation\Application;
use LaravelDoctrine\Extensions\Translatable\TranslatableExtension;
use LaravelDoctrineTest\Extensions\Feature\TestCase;
use Mockery as m;

use function app;

class TranslatableExtensionTest extends TestCase
{
public function testCanRegisterExtension(): void
{
$app = m::mock(Application::class);
$app->shouldReceive('getLocale')->once()->andReturn('en');

$config = m::mock(Repository::class);
$config->shouldReceive('get')
->with('app.locale')->once()
->andReturn('en');

$events = m::mock(Dispatcher::class);
$events->shouldReceive('listen')
->with('locale.changed', m::type('callable'))
->once();

$extension = new TranslatableExtension($app, $config, $events);
$extension = app(TranslatableExtension::class);
$extension->addSubscribers($this->evm, $this->em);

$extension->addSubscribers(
$this->evm,
$this->em,
);
$this->app['events']->dispatch('locale.changed', ['en']);

$this->assertEmpty($extension->getFilters());
}
Expand Down

0 comments on commit 212c55c

Please sign in to comment.