Exemplo n.º 1
0
 /**
  * {@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, $generator) {
         $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) {
         if ($strict) {
             CssSelector::enableHtmlExtension();
         } else {
             CssSelector::disableHtmlExtension();
         }
         $asserter = new Asserters\Crawler($generator);
         return $asserter->setWith($crawler);
     });
 }
Exemplo n.º 2
0
 public function testHasElement()
 {
     $this->if($object = new TestedClass($generator = new asserter\generator()))->and($crawler = new \mock\Symfony\Component\DomCrawler\Crawler())->and($results = new \mock\Symfony\Component\DomCrawler\Crawler())->and($this->calling($crawler)->filter = $results)->and($object->setWith($crawler))->then->object($element = $object->hasElement($selector = uniqid()))->isInstanceOf('\\atoum\\AtoumBundle\\Test\\Asserters\\Element')->object($element->getParent())->isIdenticalTo($object)->object($element->getValue())->isIdenticalTo($results);
 }
Exemplo n.º 3
0
 /**
  * @param asserter\generator      $generator
  * @param tools\variable\analyzer $analyzer
  * @param atoum\locale            $locale
  */
 public function __construct(asserter\generator $generator = null, tools\variable\analyzer $analyzer = null, atoum\locale $locale = null)
 {
     parent::__construct($generator, $analyzer, $locale);
     $this->atLeast = 1;
 }