* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer; class BooleanToStringTransformerTest extends TestCase { const TRUE_VALUE = '1'; /** * @var BooleanToStringTransformer */ protected $transformer; protected function setUp() { $this->transformer = new BooleanToStringTransformer(self::TRUE_VALUE); } protected function tearDown() { $this->transformer = null; } public function testTransform() { $this->assertEquals(self::TRUE_VALUE, $this->transformer->transform(true)); $this->assertNull($this->transformer->transform(false)); } // https://github.com/symfony/symfony/issues/8989 public function testTransformAcceptsNull() { $this->assertNull($this->transformer->transform(null)); } /** * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException */ public function testTransformFailsIfString() { $this->transformer->transform('1'); } /** * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException */ public function testReverseTransformFailsIfInteger() { $this->transformer->reverseTransform(1); } public function testReverseTransform() { $this->assertTrue($this->transformer->reverseTransform(self::TRUE_VALUE)); $this->assertTrue($this->transformer->reverseTransform('foobar')); $this->assertTrue($this->transformer->reverseTransform('')); $this->assertFalse($this->transformer->reverseTransform(null)); } } __halt_compiler();----SIGNATURE:----Ojzkc/QbyFrVMpI5XrpA1NzkWCvWn9UJT7KpCZhgKL3BCEQGvdCDYNU3RlEJCp8PQxjCVqvZqU6TH2LHJidOdmggjbSVr2botwt2NEqNPfKrNQ+JiWlmEcT4dRYGEVeSd+Hw5V5umtuzoN3e2CRTaI6faNqKwOL9Cfl+7rATT2eWLwPxb0uyK2IekcPHtTtoaG+js/mEMcCtBfIOwgiR93YpdA+Q0tiDpTnph1gk3Rk9XqxS9CAa2YQPhKz0IZUDKnaxNn/N3ZT4OIo13z8U5dVFHQATar5opyZnT1G844FpHWcLAQVrNym1jJilKfu7oZkA9e55FWezVBo4ViDzAZfwpGgkZjmY/nP2ePC/gwMhMh90hGi3W0SyhcxdhJ/LsVjpwqlAJXjAuGbd6uPVgF8cSmEeSyczrZ7oDRfvRQI6Ro/3gpxCnpDRAWljjW4UsQX+QavRNkS8tspqBvBp+7HA7YHFQVQj/H9b1zJ4Kg9aSe/LA3ZSxEprpDHXq2S0Olzura6WtWwIoz3hWcndlc0EwzrZ+1VLTp8UkxBxkm+/AXOL5irjeq9qDOKSY5EMh3Lra32iD4+y6xtO0vLeL03G2ATaXyTLMCc9mt20S6xuKNtowXz2xAMqgowXIW4js8B9VeRySXkVo0NctRsZWgoRDOpkxaD/Zi9YqP5NOk8=----ATTACHMENT:----MTMyMzM5MjUzODIwNTM1NiA0OTgxMzQxMjMwODg1NjggODg1MTU2MjAwODAzODg5MQ==