Skip to content

Commit

Permalink
Rename createViewInstance to createProjectionInstance (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored and wachterjohannes committed Dec 18, 2019
1 parent 66f4145 commit 5faa1c6
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function create(DimensionContentCollectionInterface $dimensionContentColl
$dimensionContentCollectionArray = iterator_to_array($dimensionContentCollection);
$lastKey = \count($dimensionContentCollectionArray) - 1;

$contentProjection = $dimensionContentCollectionArray[$lastKey]->createViewInstance();
$contentProjection = $dimensionContentCollectionArray[$lastKey]->createProjectionInstance();

foreach ($dimensionContentCollection as $dimensionContent) {
/** @var MergerInterface $merger */
Expand Down
2 changes: 1 addition & 1 deletion Content/Domain/Model/DimensionContentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ public function getId();

public function getDimension(): DimensionInterface;

public function createViewInstance(): ContentProjectionInterface;
public function createProjectionInstance(): ContentProjectionInterface;
}
2 changes: 1 addition & 1 deletion Tests/Application/ExampleTestBundle/Entity/Example.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public static function getResourceKey(): string

public function createDimensionContent(DimensionInterface $dimension): DimensionContentInterface
{
return new ExampleDimension($this, $dimension);
return new ExampleDimensionContent($this, $dimension);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
use Sulu\Bundle\ContentBundle\Content\Domain\Model\WorkflowInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\WorkflowTrait;

class ExampleDimension extends AbstractDimensionContent implements ExcerptInterface, SeoInterface, TemplateInterface, RoutableInterface, WorkflowInterface
class ExampleDimensionContent extends AbstractDimensionContent implements ExcerptInterface, SeoInterface, TemplateInterface, RoutableInterface, WorkflowInterface
{
use ExcerptTrait;
use SeoTrait;
Expand Down Expand Up @@ -84,7 +84,7 @@ public function setTemplateData(array $templateData): void
$this->parentSetTemplateData($templateData);
}

public function createViewInstance(): ContentProjectionInterface
public function createProjectionInstance(): ContentProjectionInterface
{
$contentProjection = new ExampleView($this->getExample(), $this->dimension);
$contentProjection->setTitle($this->getTitle());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<generator strategy="AUTO"/>
</id>

<one-to-many field="dimensionContents" target-entity="Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\ExampleDimension" mapped-by="example">
<one-to-many field="dimensionContents" target-entity="Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\ExampleDimensionContent" mapped-by="example">
<cascade>
<cascade-persist/>
</cascade>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\ExampleDimension"
table="test_example_dimensions">
<entity name="Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\ExampleDimensionContent"
table="test_example_dimension_contents">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Repository\DimensionContentRepositoryInterface;
use Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\Example;
use Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\ExampleDimension;
use Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\ExampleDimensionContent;
use Sulu\Bundle\ContentBundle\Tests\Functional\BaseTestCase;

class DimensionContentRepositoryTest extends BaseTestCase
Expand Down Expand Up @@ -151,9 +151,9 @@ private function createContentRichEntity(): Example
return $example;
}

private function createContentDimension(Example $example, DimensionInterface $dimension): ExampleDimension
private function createContentDimension(Example $example, DimensionInterface $dimension): ExampleDimensionContent
{
$exampleDimension = new ExampleDimension($example, $dimension);
$exampleDimension = new ExampleDimensionContent($example, $dimension);
$this->getEntityManager()->persist($exampleDimension);

return $exampleDimension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testCreate(): void

$contentProjection = $this->prophesize(ContentProjectionInterface::class);

$contentProjectionDimension3->createViewInstance()->willReturn($contentProjection->reveal())->shouldBeCalled();
$contentProjectionDimension3->createProjectionInstance()->willReturn($contentProjection->reveal())->shouldBeCalled();

$viewFactory = $this->getViewFactoryInstance();
$viewFactory->create(new DimensionContentCollection([
Expand Down Expand Up @@ -78,7 +78,7 @@ public function testCreateMergers(): void
$merger3->merge($contentProjection, $contentProjectionDimension2)->shouldBeCalled();
$merger3->merge($contentProjection, $contentProjectionDimension3)->shouldBeCalled();

$contentProjectionDimension3->createViewInstance()->willReturn($contentProjection->reveal())->shouldBeCalled();
$contentProjectionDimension3->createProjectionInstance()->willReturn($contentProjection->reveal())->shouldBeCalled();

$viewFactory = $this->getViewFactoryInstance([
$merger1->reveal(),
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Content/Domain/Model/ContentRichEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function setId(int $id): void
$this->id = $id;
}

public function createViewInstance(): ContentProjectionInterface
public function createProjectionInstance(): ContentProjectionInterface
{
return new class() extends AbstractContentProjection {
public function getContentId()
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Content/Domain/Model/DimensionContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(DimensionInterface $dimension)
$this->dimension = $dimension;
}

public function createViewInstance(): ContentProjectionInterface
public function createProjectionInstance(): ContentProjectionInterface
{
return new class() extends AbstractContentProjection {
public function getContentId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use Sulu\Bundle\ContentBundle\Content\Domain\Model\TemplateInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\WorkflowInterface;
use Sulu\Bundle\ContentBundle\Content\Infrastructure\Doctrine\MetadataLoader;
use Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\ExampleDimension;
use Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\ExampleDimensionContent;
use Sulu\Bundle\TagBundle\Tag\TagInterface;

class MetadataLoaderTest extends TestCase
Expand Down Expand Up @@ -77,7 +77,7 @@ public function testInvalidMetadata(array $interfaces, array $fields, array $man
$classMetadata->getReflectionClass()->willReturn($reflectionClass->reveal());
$classMetadata->getTableName()->willReturn('test_example');
$classMetadata->getIdentifierColumnNames()->willReturn(['id']);
$classMetadata->getName()->willReturn(ExampleDimension::class);
$classMetadata->getName()->willReturn(ExampleDimensionContent::class);

foreach ($fields as $field => $exist) {
$classMetadata->hasField($field)->willReturn($exist);
Expand Down

0 comments on commit 5faa1c6

Please sign in to comment.