Skip to content

Commit

Permalink
fix: phpstan and phpunit errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreyu committed Feb 9, 2024
1 parent 7c6d57c commit 80eba09
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/DependencyInjection/KreyuDataTableExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Kreyu\Bundle\DataTableBundle\Exporter\Extension\ExporterExtensionInterface;
use Kreyu\Bundle\DataTableBundle\Exporter\Extension\ExporterTypeExtensionInterface;
use Kreyu\Bundle\DataTableBundle\Exporter\Type\ExporterTypeInterface;
use Kreyu\Bundle\DataTableBundle\Extension\DataTableExtensionInterface;
use Kreyu\Bundle\DataTableBundle\Extension\DataTableTypeExtensionInterface;
use Kreyu\Bundle\DataTableBundle\Filter\Extension\FilterExtensionInterface;
use Kreyu\Bundle\DataTableBundle\Filter\Extension\FilterTypeExtensionInterface;
Expand All @@ -32,7 +31,6 @@
class KreyuDataTableExtension extends Extension implements PrependExtensionInterface
{
private array $autoconfiguration = [
DataTableExtensionInterface::class => 'kreyu_data_table.extension',
DataTableTypeInterface::class => 'kreyu_data_table.type',
DataTableTypeExtensionInterface::class => 'kreyu_data_table.type_extension',
ColumnExtensionInterface::class => 'kreyu_data_table.column.extension',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Kreyu\Bundle\DataTableBundle\Exception\UnexpectedTypeException;
use Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Query\DoctrineOrmProxyQuery;
use Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Query\DoctrineOrmProxyQueryFactory;
use PHPUnit\Framework\TestCase;
Expand All @@ -20,22 +19,23 @@ protected function setUp(): void
$this->factory = new DoctrineOrmProxyQueryFactory();
}

public function testCreatingWithSupportedData(): void
public function testSupportsQueryBuilder()
{
$queryBuilder = $this->createStub(QueryBuilder::class);

$data = $this->factory->create($queryBuilder);
$this->assertTrue($this->factory->supports($this->createStub(QueryBuilder::class)));
}

$this->assertInstanceOf(DoctrineOrmProxyQuery::class, $data);
$this->assertEquals($queryBuilder, $data->getQueryBuilder());
public function testNotSupportsQuery(): void
{
$this->assertFalse($this->factory->supports($this->createStub(Query::class)));
}

public function testCreatingWithNotSupportedData(): void
public function testCreate(): void
{
$data = $this->createStub(Query::class);
$queryBuilder = $this->createStub(QueryBuilder::class);

$this->expectExceptionObject(new UnexpectedTypeException($data, QueryBuilder::class));
$data = $this->factory->create($queryBuilder);

$this->factory->create($data);
$this->assertInstanceOf(DoctrineOrmProxyQuery::class, $data);
$this->assertEquals($queryBuilder, $data->getQueryBuilder());
}
}
2 changes: 2 additions & 0 deletions tests/Unit/DataTableRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function testGetTypeWithNonExistentType()
{
$this->expectException(InvalidArgumentException::class);

// @phpstan-ignore-next-line
$this->createRegistry()->getType('stdClass');
}

Expand Down Expand Up @@ -101,6 +102,7 @@ public function testHasType()

public function testHasTypeWithNonExistentType()
{
// @phpstan-ignore-next-line
$this->assertFalse($this->createRegistry()->hasType('stdClass'));
}

Expand Down

0 comments on commit 80eba09

Please sign in to comment.