Skip to content

Commit

Permalink
VO tests added, cs fix applied
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorkmaz committed Jun 28, 2020
1 parent 11fab18 commit 3c3f29a
Show file tree
Hide file tree
Showing 111 changed files with 841 additions and 392 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor/
composer.lock
composer.lock
storage/
24 changes: 24 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
stopOnFailure="true"
bootstrap="vendor/autoload.php"
colors="true">
<php>
<ini name="memory_limit" value="-1"/>
</php>
<testsuites>
<testsuite name="BackendBase Unit Tests">
<directory>test/UnitTest</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src/BackendBase/Domain</directory>
<directory suffix=".php">./src/BackendBase/Shared</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="storage/temp/clover.xml"/>
</logging>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\Collections\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class CollectionExists extends Exception implements ProblemDetailsExceptionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\Collections\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class CollectionNotFound extends Exception implements ProblemDetailsExceptionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace BackendBase\Domain\Collections\Persistence\Doctrine;

use Doctrine\DBAL\Driver\Connection;
use Doctrine\ORM\EntityManager;
use BackendBase\Domain\Collections\Interfaces\CollectionQuery as CollectionQueryInterface;
use BackendBase\Domain\Collections\Model\Collections;
use BackendBase\Domain\Collections\Persistence\Doctrine\ResultObject\Collection as CollectionResultObject;
use BackendBase\Domain\Collections\Persistence\Doctrine\SqlQuery\GetCollectionItem;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\ORM\EntityManager;
use Redislabs\Module\ReJSON\ReJSON;
use const JSON_OBJECT_AS_ARRAY;
use const SORT_NATURAL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace BackendBase\Domain\Collections\Persistence\Doctrine;

use Doctrine\DBAL\Driver\Connection;
use Doctrine\ORM\EntityManager;
use BackendBase\Domain\Collections\Interfaces\CollectionRepository as CollectionRepositoryInterface;
use BackendBase\Domain\Collections\Model\Collection;
use BackendBase\Domain\Collections\Persistence\Doctrine\ResultObject\Collection as CollectionResultObject;
use BackendBase\Domain\Collections\Persistence\Doctrine\SqlQuery\GetCollectionItem;
use BackendBase\Infrastructure\Persistence\Doctrine\Entity\Collection as DoctrineCollectionEntity;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\ORM\EntityManager;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
use Redislabs\Module\ReJSON\ReJSON;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\Collections\Persistence\Doctrine\ResultObject;

use JsonSerializable;
use BackendBase\Shared\Services\Persistence\ResultObject;
use JsonSerializable;
use const JSON_OBJECT_AS_ARRAY;
use function gettype;
use function json_decode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace BackendBase\Domain\Collections\Persistence\Doctrine\SqlQuery;

use Doctrine\DBAL\FetchMode;
use BackendBase\Domain\Collections\Exception\CollectionNotFound;
use BackendBase\Domain\Collections\Model\Collections;
use BackendBase\Domain\Collections\Persistence\Doctrine\ResultObject\Collection;
use BackendBase\Domain\Shared\Exception\ExecutionFailed;
use BackendBase\Shared\Services\Persistence\SqlQuery;
use Doctrine\DBAL\FetchMode;
use Throwable;
use function count;
use function sprintf;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\Contents\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class ContentNotFound extends Exception implements ProblemDetailsExceptionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\IdentityAndAccess\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class AuthenticationFailed extends Exception implements ProblemDetailsExceptionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\IdentityAndAccess\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class InsufficientPrivileges extends Exception implements ProblemDetailsExceptionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\IdentityAndAccess\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class InvalidApiKey extends Exception implements ProblemDetailsExceptionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\IdentityAndAccess\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class LoginAttemptLimitExceeded extends Exception implements ProblemDetailsExceptionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@

class Forms
{
public const FORMS_MENU = 'forms-menu';

public const FORMS_MENU = 'forms-menu';
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\User\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class CantUnregisterUserDoesNotExists extends Exception implements ProblemDetailsExceptionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\User\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class InvalidEmailAddress extends Exception implements ProblemDetailsExceptionInterface
Expand Down
2 changes: 1 addition & 1 deletion src/BackendBase/Domain/User/Exception/InvalidFirstName.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\User\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class InvalidFirstName extends Exception implements ProblemDetailsExceptionInterface
Expand Down
2 changes: 1 addition & 1 deletion src/BackendBase/Domain/User/Exception/InvalidLastName.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\User\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class InvalidLastName extends Exception implements ProblemDetailsExceptionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\User\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class UserAlreadyExists extends Exception implements ProblemDetailsExceptionInterface
Expand Down
2 changes: 1 addition & 1 deletion src/BackendBase/Domain/User/Exception/UserNotFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\User\Exception;

use Exception;
use BackendBase\Domain\Shared\Exception\DomainException;
use Exception;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;

class UserNotFound extends Exception implements ProblemDetailsExceptionInterface
Expand Down
2 changes: 1 addition & 1 deletion src/BackendBase/Domain/User/Interfaces/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace BackendBase\Domain\User\Interfaces;

use BackendBase\Shared\Exception\ExecutionFailed;
use BackendBase\Domain\User\Exception\UserNotFound;
use BackendBase\Domain\User\Model\User;
use BackendBase\Shared\Exception\ExecutionFailed;
use BackendBase\Shared\ValueObject\Email;

interface UserRepository
Expand Down
4 changes: 2 additions & 2 deletions src/BackendBase/Domain/User/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace BackendBase\Domain\User\Model;

use Carbon\CarbonImmutable;
use DateTimeImmutable;
use BackendBase\Domain\User\Exception\InvalidFirstName;
use BackendBase\Domain\User\Interfaces\UserId as UserIdInterface;
use BackendBase\Shared\ValueObject\Email;
use Carbon\CarbonImmutable;
use DateTimeImmutable;
use Throwable;
use Webmozart\Assert\Assert;
use function password_verify;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Domain\User\Persistence\Doctrine\ResultObject;

use JsonSerializable;
use BackendBase\Shared\Services\Persistence\ResultObject;
use JsonSerializable;

class User implements JsonSerializable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace BackendBase\Domain\User\Persistence\Doctrine\SqlQuery;

use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\FetchMode;
use BackendBase\Domain\Shared\Exception\ExecutionFailed;
use BackendBase\Domain\Shared\Exception\InvalidArgument;
use BackendBase\Domain\User\Model\Users;
use BackendBase\Domain\User\Persistence\Doctrine\ResultObject\User;
use BackendBase\Shared\Services\Persistence\SqlQuery;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\FetchMode;
use Throwable;
use function array_key_exists;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace BackendBase\Domain\User\Persistence\Doctrine\SqlQuery;

use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\FetchMode;
use BackendBase\Domain\Shared\Exception\ExecutionFailed;
use BackendBase\Domain\Shared\Exception\InvalidArgument;
use BackendBase\Domain\User\Exception\UserNotFound;
use BackendBase\Domain\User\Persistence\Doctrine\ResultObject\User;
use BackendBase\Shared\Services\Persistence\SqlQuery;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\FetchMode;
use Throwable;
use function array_key_exists;
use function count;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace BackendBase\Domain\User\Persistence\Doctrine\SqlQuery;

use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\FetchMode;
use BackendBase\Domain\Shared\Exception\ExecutionFailed;
use BackendBase\Domain\Shared\Exception\InvalidArgument;
use BackendBase\Domain\User\Exception\UserNotFound;
use BackendBase\Domain\User\Persistence\Doctrine\ResultObject\User;
use BackendBase\Shared\Services\Persistence\SqlQuery;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\FetchMode;
use Throwable;
use function array_key_exists;
use function count;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace BackendBase\Domain\User\Persistence\Doctrine;

use Doctrine\DBAL\Driver\Connection;
use BackendBase\Domain\User\Interfaces\UserId;
use BackendBase\Domain\User\Interfaces\UserQuery as UserQueryInterface;
use BackendBase\Domain\User\Model\Users;
Expand All @@ -13,6 +12,7 @@
use BackendBase\Domain\User\Persistence\Doctrine\SqlQuery\GetUserByEmail;
use BackendBase\Domain\User\Persistence\Doctrine\SqlQuery\GetUserById;
use BackendBase\Shared\ValueObject\Interfaces\Email;
use Doctrine\DBAL\Driver\Connection;

class UserQuery implements UserQueryInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace BackendBase\Domain\User\Persistence\Doctrine;

use Doctrine\DBAL\Driver\Connection;
use BackendBase\Domain\User\Exception\CantUnregisterUserDoesNotExists;
use BackendBase\Domain\User\Exception\UserAlreadyExists;
use BackendBase\Domain\User\Exception\UserNotFound;
Expand All @@ -16,6 +15,7 @@
use BackendBase\Shared\Exception\ExecutionFailed;
use BackendBase\Shared\Exception\InvalidArgument;
use BackendBase\Shared\ValueObject\Email;
use Doctrine\DBAL\Driver\Connection;
use Throwable;
use function sprintf;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace BackendBase\Infrastructure\Persistence\Doctrine\Entity;

use DateTimeImmutable;
use BackendBase\Infrastructure\Persistence\Doctrine\AbstractDoctrineEntity;
use DateTimeImmutable;
use function base_convert;
use function microtime;
use function usleep;
use function hrtime;

/**
* @Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace BackendBase\Infrastructure\Persistence\Doctrine\Entity;

use DateTimeImmutable;
use BackendBase\Infrastructure\Persistence\Doctrine\AbstractDoctrineEntity;
use DateTimeImmutable;

/**
* @Entity
Expand Down
Loading

0 comments on commit 3c3f29a

Please sign in to comment.