Skip to content

Commit

Permalink
EZP-32281: Abandoned deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
barw4 committed Mar 2, 2021
1 parent 899fdcb commit 80294ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\FieldType\Tests\Integration\BinaryBase\BinaryBaseStorage;

use eZ\Publish\API\Repository\Values\Content\ContentInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Integration\BinaryBase\BinaryBaseStorage;

use eZ\Publish\API\Repository\Values\Content\ContentInfo;
use eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage;
use eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\Gateway;
use eZ\Publish\Core\FieldType\BinaryFile\BinaryFileStorage\Gateway\DoctrineStorage;
use eZ\Publish\Core\FieldType\Tests\Integration\BaseCoreFieldTypeIntegrationTest;
use eZ\Publish\Core\IO\IOServiceInterface;
use eZ\Publish\Core\IO\Values\BinaryFile;
use eZ\Publish\Core\IO\Values\BinaryFileCreateStruct;
use eZ\Publish\Core\Persistence\Legacy\Tests\TestCase;
use eZ\Publish\SPI\FieldType\BinaryBase\PathGenerator;
use eZ\Publish\SPI\IO\MimeTypeDetector;
use eZ\Publish\SPI\Persistence\Content\Field;
use eZ\Publish\SPI\Persistence\Content\FieldValue;
use eZ\Publish\SPI\Persistence\Content\VersionInfo;

class BinaryBaseStorageTest extends TestCase
class BinaryBaseStorageTest extends BaseCoreFieldTypeIntegrationTest
{
/** @var \eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\Gateway|\PHPUnit\Framework\MockObject\MockObject */
protected $gatewayMock;
protected $gateway;

/** @var \eZ\Publish\SPI\FieldType\BinaryBase\PathGenerator|\PHPUnit\Framework\MockObject\MockObject */
protected $pathGeneratorMock;
Expand All @@ -36,14 +38,16 @@ class BinaryBaseStorageTest extends TestCase

protected function setUp(): void
{
$this->gatewayMock = $this->getStorageGateway();
parent::setUp();

$this->gateway = $this->getStorageGateway();
$this->pathGeneratorMock = $this->createMock(PathGenerator::class);
$this->ioServiceMock = $this->createMock(IOServiceInterface::class);
$this->storage = $this->getMockBuilder(BinaryBaseStorage::class)
->setMethods(null)
->onlyMethods([])
->setConstructorArgs(
[
$this->gatewayMock,
$this->gateway,
$this->ioServiceMock,
$this->pathGeneratorMock,
$this->createMock(MimeTypeDetector::class),
Expand All @@ -59,7 +63,7 @@ protected function getContext(): array

public function testHasFieldData(): void
{
$this->assertTrue($this->storage->hasFieldData());
self::assertTrue($this->storage->hasFieldData());
}

/**
Expand All @@ -74,18 +78,18 @@ public function testStoreFieldData(VersionInfo $versionInfo, Field $field): void
]);

$this->ioServiceMock
->expects($this->once())
->expects(self::once())
->method('newBinaryCreateStructFromLocalFile')
->will($this->returnValue($binaryFileCreateStruct));

$this->pathGeneratorMock
->expects($this->once())
->expects(self::once())
->method('getStoragePathForField')
->with($field, $versionInfo)
->willReturn('image/qwerty12345.jpg');

$this->ioServiceMock
->expects($this->once())
->expects(self::once())
->method('createBinaryFile')
->with($binaryFileCreateStruct)
->willReturn(new BinaryFile());
Expand Down Expand Up @@ -116,7 +120,7 @@ public function testCopyLegacyField(VersionInfo $versionInfo, Field $originalFie

$flag = $this->storage->copyLegacyField($versionInfo, $field, $originalField, $this->getContext());

$this->assertFalse($flag);
self::assertFalse($flag);
}

public function providerOfFieldData(): array
Expand Down

0 comments on commit 80294ce

Please sign in to comment.