DocumentElement.php 995 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /*
  3. * This file is part of the Mink package.
  4. * (c) Konstantin Kudryashov <ever.zet@gmail.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. namespace Behat\Mink\Element;
  10. /**
  11. * Document element.
  12. *
  13. * @author Konstantin Kudryashov <ever.zet@gmail.com>
  14. */
  15. class DocumentElement extends TraversableElement
  16. {
  17. /**
  18. * Returns XPath for handled element.
  19. *
  20. * @return string
  21. */
  22. public function getXpath()
  23. {
  24. return '//html';
  25. }
  26. /**
  27. * Returns document content.
  28. *
  29. * @return string
  30. */
  31. public function getContent()
  32. {
  33. return trim($this->getDriver()->getContent());
  34. }
  35. /**
  36. * Check whether document has specified content.
  37. *
  38. * @param string $content
  39. *
  40. * @return Boolean
  41. */
  42. public function hasContent($content)
  43. {
  44. return $this->has('named', array('content', $content));
  45. }
  46. }