Skip to content

Add a filter for serialization attributes #1123

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

Merged
merged 2 commits into from
May 23, 2017
Merged
Show file tree
Hide file tree
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
45 changes: 44 additions & 1 deletion features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyCar;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyCarColor;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyFriend;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyGroup;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyOffer;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyProduct;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyProperty;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Node;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Question;
Expand All @@ -35,6 +37,7 @@
use Behat\Behat\Context\SnippetAcceptingContext;
use Behatch\HttpCall\Request;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Tools\SchemaTool;

/**
Expand All @@ -45,7 +48,7 @@ class FeatureContext implements Context, SnippetAcceptingContext
private $doctrine;

/**
* @var \Doctrine\Common\Persistence\ObjectManager
* @var ObjectManager
*/
private $manager;

Expand Down Expand Up @@ -127,6 +130,46 @@ public function thereIsDummyObjects($nb)
$this->manager->flush();
}

/**
* @Given there is :nb dummy group objects
*/
public function thereIsDummyGroupObjects($nb)
{
for ($i = 1; $i <= $nb; ++$i) {
$dummyGroup = new DummyGroup();

foreach (['foo', 'bar', 'baz', 'qux'] as $property) {
$dummyGroup->$property = ucfirst($property).' #'.$i;
}

$this->manager->persist($dummyGroup);
}

$this->manager->flush();
}

/**
* @Given there is :nb dummy property objects
*/
public function thereIsDummyPropertyObjects($nb)
{
for ($i = 1; $i <= $nb; ++$i) {
$dummyProperty = new DummyProperty();
$dummyGroup = new DummyGroup();

foreach (['foo', 'bar', 'baz'] as $property) {
$dummyProperty->$property = $dummyGroup->$property = ucfirst($property).' #'.$i;
}

$dummyProperty->group = $dummyGroup;

$this->manager->persist($dummyGroup);
$this->manager->persist($dummyProperty);
}

$this->manager->flush();
}

/**
* @Given there is :nb dummy objects with relatedDummy
*/
Expand Down
Loading