Skip to content

Commit

Permalink
remove unused cache dir in response factory
Browse files Browse the repository at this point in the history
fix config namespace for using class constants
  • Loading branch information
Marcel Strahl committed Sep 17, 2020
1 parent 6238d2f commit d2b227c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
7 changes: 1 addition & 6 deletions src/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Dropelikeit\LaravelJmsSerializer;

use ArrayIterator;
use Dropelikeit\LaravelJmsSerializer\Config\Config;
use Dropelikeit\LaravelJmsSerializer\Config\ConfigInterface;
use Dropelikeit\LaravelJmsSerializer\Exception\SerializeType;
use JMS\Serializer\SerializationContext;
Expand Down Expand Up @@ -40,17 +41,11 @@ final class ResponseFactory
*/
private $serializeType;

/**
* @var string
*/
private $cacheDir;

public function __construct(SerializerInterface $serializer, ConfigInterface $config)
{
$this->config = $config;
$this->serializer = $serializer;
$this->serializeType = $config->getSerializeType();
$this->cacheDir = $config->getCacheDir();
}

public function withStatusCode(int $code): void
Expand Down
14 changes: 7 additions & 7 deletions tests/ResponseFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function setUp(): void
public function canCreateResponse(): void
{
$this->config
->expects(self::exactly(2))
->expects(self::once())
->method('getCacheDir')
->willReturn(__DIR__);

Expand Down Expand Up @@ -68,7 +68,7 @@ public function canCreateResponse(): void
public function canCreateFromArrayIterator(): void
{
$this->config
->expects(self::exactly(2))
->expects(self::once())
->method('getCacheDir')
->willReturn(__DIR__);

Expand Down Expand Up @@ -96,7 +96,7 @@ public function canCreateFromArrayIterator(): void
public function canCreateResponseFromArray(): void
{
$this->config
->expects(self::exactly(2))
->expects(self::once())
->method('getCacheDir')
->willReturn(__DIR__);

Expand Down Expand Up @@ -127,7 +127,7 @@ public function canCreateResponseFromArray(): void
public function canChangeStatusCode(): void
{
$this->config
->expects(self::exactly(2))
->expects(self::once())
->method('getCacheDir')
->willReturn(__DIR__);

Expand Down Expand Up @@ -157,7 +157,7 @@ public function canChangeStatusCode(): void
public function canUseGivenContext(): void
{
$this->config
->expects(self::exactly(2))
->expects(self::once())
->method('getCacheDir')
->willReturn(__DIR__);

Expand Down Expand Up @@ -185,7 +185,7 @@ public function canUseGivenContext(): void
public function canWithSerializeType(): void
{
$this->config
->expects(self::exactly(3))
->expects(self::once())
->method('getCacheDir')
->willReturn(__DIR__);

Expand Down Expand Up @@ -224,7 +224,7 @@ public function canNotCreateWithUnknownSerializeType(): void
$this->expectException(SerializeType::class);

$this->config
->expects(self::exactly(2))
->expects(self::once())
->method('getCacheDir')
->willReturn(__DIR__);

Expand Down

0 comments on commit d2b227c

Please sign in to comment.