Skip to content

Commit

Permalink
Added namespace to DoctrinePresenceVerifierTest;
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Oct 27, 2024
1 parent 3b006b1 commit 8db3b31
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
7 changes: 7 additions & 0 deletions tests/Assets/Mock/CountableEntityMock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets\Mock;

class CountableEntityMock
{
}
2 changes: 1 addition & 1 deletion tests/Feature/DoctrineManagerTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LaravelDoctrineTest\ORM;
namespace LaravelDoctrineTest\ORM\Feature;

use Doctrine\Common\EventManager;
use Doctrine\DBAL\Connection;
Expand Down
17 changes: 9 additions & 8 deletions tests/Feature/Validation/DoctrinePresenceVerifierTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php

use Doctrine\ORM\AbstractQuery;
namespace LaravelDoctrineTest\ORM\Feature\Validation;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
use InvalidArgumentException;
use LaravelDoctrine\ORM\Validation\DoctrinePresenceVerifier;
use LaravelDoctrineTest\ORM\Assets\Mock\CountableEntityMock;
use Mockery as m;
use Mockery\Mock;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -43,7 +48,7 @@ protected function setUp(): void
$this->em = m::mock(EntityManagerInterface::class);
$this->registry = m::mock(ManagerRegistry::class);
$this->builder = m::mock(QueryBuilder::class);
$this->query = m::mock(Doctrine\ORM\Query::class);
$this->query = m::mock(Query::class);

$this->verifier = new DoctrinePresenceVerifier(
$this->registry
Expand Down Expand Up @@ -200,7 +205,7 @@ public function test_counting_invalid_entity_throws_exception()
->andReturn(null);

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('No Entity Manager could be found for [CountableEntityMock].');
$this->expectExceptionMessage('No Entity Manager could be found for [LaravelDoctrineTest\ORM\Assets\Mock\CountableEntityMock].');

$this->verifier->getCount(CountableEntityMock::class, 'email', 'test@email.com');
}
Expand Down Expand Up @@ -254,7 +259,7 @@ protected function defaultGetMultiCountMocks()
$this->builder->shouldReceive('where')
->once();

$this->builder->shouldReceive('expr')->andReturn(new \Doctrine\ORM\Query\Expr());
$this->builder->shouldReceive('expr')->andReturn(new Expr());
$this->builder->shouldReceive('in')->with("e.email", ['test@email.com']);

$this->builder->shouldReceive('getQuery')
Expand All @@ -268,7 +273,3 @@ protected function tearDown(): void
m::close();
}
}

class CountableEntityMock
{
}

0 comments on commit 8db3b31

Please sign in to comment.