/** * {@inheritdoc} */ public function __construct(atoum\adapter $adapter = null, atoum\annotations\extractor $annotationExtractor = null, atoum\asserter\generator $asserterGenerator = null, atoum\test\assertion\manager $assertionManager = null, \closure $reflectionClassFactory = null) { parent::__construct($adapter, $annotationExtractor, $asserterGenerator, $assertionManager, $reflectionClassFactory); $this->setTestNamespace('Tests'); // Creates the form factory builder $this->factory = Forms::createFormFactoryBuilder()->addExtensions($this->getExtensions())->getFormFactory(); // Mocks the event dispatcher // Class exists test to prevent mocking again the EventDispatcherInterface if several form type tests are set to execute together if (!class_exists('\\mock\\Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')) { $this->mockGenerator->generate('\\Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); } $this->dispatcher = new \mock\Symfony\Component\EventDispatcher\EventDispatcherInterface(); $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory); }
/** * {@inheritdoc} */ public function __construct(atoum\adapter $adapter = null, atoum\annotations\extractor $annotationExtractor = null, atoum\asserter\generator $asserterGenerator = null, atoum\test\assertion\manager $assertionManager = null, \closure $reflectionClassFactory = null) { parent::__construct($adapter, $annotationExtractor, $asserterGenerator, $assertionManager, $reflectionClassFactory); $generator = $this->getAsserterGenerator(); $test = $this; $crawler = null; $client = null; $this->getAssertionManager()->setHandler('request', function (array $options = array(), array $server = array(), array $cookies = array()) use(&$client, $test) { $client = $test->createClient($options, $server, $cookies); return $test; })->setHandler('get', $get = $this->getSendRequestHandler($client, $crawler, 'GET'))->setHandler('GET', $get)->setHandler('head', $head = $this->getSendRequestHandler($client, $crawler, 'HEAD'))->setHandler('HEAD', $head)->setHandler('post', $post = $this->getSendRequestHandler($client, $crawler, 'POST'))->setHandler('POST', $post)->setHandler('put', $put = $this->getSendRequestHandler($client, $crawler, 'PUT'))->setHandler('PUT', $put)->setHandler('patch', $patch = $this->getSendRequestHandler($client, $crawler, 'PATCH'))->setHandler('PATCH', $patch)->setHandler('delete', $delete = $this->getSendRequestHandler($client, $crawler, 'DELETE'))->setHandler('DELETE', $delete)->setHandler('options', $options = $this->getSendRequestHandler($client, $crawler, 'OPTIONS'))->setHandler('OPTIONS', $options)->setHandler('crawler', function ($strict = false) use(&$crawler, $generator, $test) { if ($strict) { CssSelector::enableHtmlExtension(); } else { CssSelector::disableHtmlExtension(); } return $generator->getAsserterInstance('\\atoum\\AtoumBundle\\Test\\Asserters\\Crawler', array($crawler), $test); }); }