Skip to content

Commit

Permalink
Add a filter for serialization attributes (#1123)
Browse files Browse the repository at this point in the history
  • Loading branch information
meyerbaptiste authored and dunglas committed May 23, 2017
1 parent 183b0a5 commit e3c17c8
Show file tree
Hide file tree
Showing 16 changed files with 2,015 additions and 5 deletions.
45 changes: 44 additions & 1 deletion features/bootstrap/FeatureContext.php
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

0 comments on commit e3c17c8

Please sign in to comment.