Skip to content

Commit e32b518

Browse files
Merge branch '2.8' into 3.4
* 2.8: [Form] Hardened test suite for empty data Bump phpunit XSD version to 5.2 Add required key attribute
2 parents 49ddced + 131a42b commit e32b518

File tree

75 files changed

+321
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+321
-71
lines changed

phpunit.xml.dist

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"
@@ -62,13 +62,13 @@
6262
<array>
6363
<element key="time-sensitive">
6464
<array>
65-
<element><string>Cache\IntegrationTests</string></element>
66-
<element><string>Doctrine\Common\Cache</string></element>
67-
<element><string>Symfony\Component\Cache</string></element>
68-
<element><string>Symfony\Component\Cache\Tests\Fixtures</string></element>
69-
<element><string>Symfony\Component\Cache\Traits</string></element>
70-
<element><string>Symfony\Component\Console</string></element>
71-
<element><string>Symfony\Component\HttpFoundation</string></element>
65+
<element key="0"><string>Cache\IntegrationTests</string></element>
66+
<element key="1"><string>Doctrine\Common\Cache</string></element>
67+
<element key="2"><string>Symfony\Component\Cache</string></element>
68+
<element key="3"><string>Symfony\Component\Cache\Tests\Fixtures</string></element>
69+
<element key="4"><string>Symfony\Component\Cache\Traits</string></element>
70+
<element key="5"><string>Symfony\Component\Console</string></element>
71+
<element key="6"><string>Symfony\Component\HttpFoundation</string></element>
7272
</array>
7373
</element>
7474
</array>

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,4 +1482,43 @@ public function testSetDataNonEmptyArraySubmitNullMultiple()
14821482
$this->assertEquals(array(), $form->getNormData());
14831483
$this->assertSame(array(), $form->getViewData(), 'View data is always an array');
14841484
}
1485+
1486+
public function testSubmitNullUsesDefaultEmptyData($emptyData = 'empty', $expectedData = null)
1487+
{
1488+
$emptyData = '1';
1489+
$entity1 = new SingleIntIdEntity(1, 'Foo');
1490+
$this->persist(array($entity1));
1491+
1492+
$form = $this->factory->create(static::TESTED_TYPE, null, array(
1493+
'em' => 'default',
1494+
'class' => self::SINGLE_IDENT_CLASS,
1495+
'empty_data' => $emptyData,
1496+
));
1497+
$form->submit(null);
1498+
1499+
$this->assertSame($emptyData, $form->getViewData());
1500+
$this->assertSame($entity1, $form->getNormData());
1501+
$this->assertSame($entity1, $form->getData());
1502+
}
1503+
1504+
public function testSubmitNullMultipleUsesDefaultEmptyData()
1505+
{
1506+
$emptyData = array('1');
1507+
$entity1 = new SingleIntIdEntity(1, 'Foo');
1508+
$this->persist(array($entity1));
1509+
1510+
$form = $this->factory->create(static::TESTED_TYPE, null, array(
1511+
'em' => 'default',
1512+
'class' => self::SINGLE_IDENT_CLASS,
1513+
'multiple' => true,
1514+
'empty_data' => $emptyData,
1515+
));
1516+
$form->submit(null);
1517+
1518+
$collection = new ArrayCollection(array($entity1));
1519+
1520+
$this->assertSame($emptyData, $form->getViewData());
1521+
$this->assertEquals($collection, $form->getNormData());
1522+
$this->assertEquals($collection, $form->getData());
1523+
}
14851524
}

src/Symfony/Bridge/Doctrine/phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"

src/Symfony/Bridge/Monolog/phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"

src/Symfony/Bridge/PhpUnit/Tests/Fixtures/coverage/phpunit-with-listener.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="tests/bootstrap.php"

src/Symfony/Bridge/PhpUnit/Tests/Fixtures/coverage/phpunit-without-listener.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="tests/bootstrap.php"

src/Symfony/Bridge/PhpUnit/phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"

src/Symfony/Bridge/ProxyManager/phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"

src/Symfony/Bridge/Twig/phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"

src/Symfony/Bundle/DebugBundle/phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"

0 commit comments

Comments
 (0)