Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PagePartBundle] Refactor HeaderPagePart entity test #2024

Merged
merged 1 commit into from
Jun 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions src/Kunstmaan/PagePartBundle/Tests/Entity/HeaderPagePartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Kunstmaan\PagePartBundle\Tests\Entity;

use Kunstmaan\PagePartBundle\Entity\HeaderPagePart;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Mapping\ClassMetadata;

/**
* Generated by PHPUnit_SkeletonGenerator on 2012-08-30 at 17:54:19.
Expand Down Expand Up @@ -36,21 +38,13 @@ protected function tearDown()
*/
public function testLoadValidatorMetadata()
{
$metadata = $this->getMockBuilder('Symfony\Component\Validator\Mapping\ClassMetadata')
->disableOriginalConstructor()
->getMock();

$metadata
->expects($this->at(0))
->method('addPropertyConstraint')
->with('niv', $this->anyThing());

$metadata
->expects($this->at(1))
->method('addPropertyConstraint')
->with('title', $this->anyThing());
$metadata = new ClassMetadata(HeaderPagePart::class);

HeaderPagePart::loadValidatorMetadata($metadata);
$this->assertArrayHasKey('niv', $metadata->properties);
$this->assertInstanceOf(NotBlank::class, $metadata->properties['niv']->getConstraints()[0]);
$this->assertArrayHasKey('title', $metadata->properties);
$this->assertInstanceOf(NotBlank::class, $metadata->properties['title']->getConstraints()[0]);
}

/**
Expand Down