Skip to content

Commit

Permalink
merged 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Nov 22, 2011
2 parents a8e8008 + 7c8d836 commit a8fd2c4
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Tests/HttpKernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ public function getProviderTypes()

public function testExceptionInSubRequestsDoesNotMangleOutputBuffers()
{
if (version_compare(phpversion(), "5.3.2", "<=")) {
$this->markTestSkipped('Test fails with PHP5.3.2 due to https://bugs.php.net/bug.php?id=50563');
}

$request = new Request();

$container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function buildView(FormView $view, FormInterface $form)
{
$view
->set('value', $form->getAttribute('value'))
->set('checked', (Boolean) $form->getData())
->set('checked', (Boolean) $form->getClientData())
;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function buildView(FormView $view, FormInterface $form)
{
$view
->set('value', $form->getAttribute('value'))
->set('checked', (Boolean) $form->getData())
->set('checked', (Boolean) $form->getClientData())
;

if ($view->hasParent()) {
Expand Down
4 changes: 3 additions & 1 deletion src/Symfony/Component/Form/Util/PropertyPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ protected function readProperty($object, $currentIndex)
throw new InvalidPropertyException(sprintf('Index "%s" cannot be read from object of type "%s" because it doesn\'t implement \ArrayAccess', $property, get_class($object)));
}

return $object[$property];
if (isset($object[$property])) {
return $object[$property];
}
} else {
$camelProp = $this->camelize($property);
$reflClass = new \ReflectionClass($object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function supportsClass($class);
/**
* Returns the vote for the given parameters.
*
* This method must return one of the following constant:
* This method must return one of the following constants:
* ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN.
*
* @param TokenInterface $token A TokenInterface instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Tests\Component\Form\Extension\Core\Type;

use Symfony\Component\Form\CallbackTransformer;

class CheckboxTypeTest extends TypeTestCase
{
public function testPassValueToView()
Expand Down Expand Up @@ -38,4 +40,39 @@ public function testNotCheckedIfDataFalse()

$this->assertFalse($view->get('checked'));
}

/**
* @dataProvider proviceTransformedData
*/
public function testTransformedData($data, $expected)
{
// present a binary status field as a checkbox
$transformer = new CallbackTransformer(
function ($value)
{
return 'expedited' == $value;
},
function ($value)
{
return $value ? 'expedited' : 'standard';
}
);

$form = $this->builder
->create('expedited_shipping', 'checkbox')
->prependClientTransformer($transformer)
->getForm();
$form->setData($data);
$view = $form->createView();

$this->assertEquals($expected, $view->get('checked'));
}

public function proviceTransformedData()
{
return array(
array('expedited', true),
array('standard', false),
);
}
}
10 changes: 10 additions & 0 deletions vendors.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
mkdir($vendorDir, 0777, true);
}

// optional transport change
$transport = false;
if (isset($argv[1]) && in_array($argv[1], array('--transport=http', '--transport=https', '--transport=git'))) {
$transport = preg_replace('/^--transport=(.*)$/', '$1', $argv[1]);
}

$deps = array(
array('doctrine', 'http://github.com/doctrine/doctrine2.git', 'origin/master'),
array('doctrine-dbal', 'http://github.com/doctrine/dbal.git', 'origin/master'),
Expand All @@ -36,6 +42,10 @@

foreach ($deps as $dep) {
list($name, $url, $rev) = $dep;

if ($transport) {
$url = preg_replace('/^(http:|https:|git:)(.*)/', $transport . ':$2', $url);
}

$installDir = $vendorDir.'/'.$name;
$install = false;
Expand Down

0 comments on commit a8fd2c4

Please sign in to comment.