PartialNamedSelector.php 1.1 KB

12345678910111213141516171819202122232425262728293031
  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\Selector;
  10. /**
  11. * Named selectors engine. Uses registered XPath selectors to create new expressions.
  12. *
  13. * @author Konstantin Kudryashov <ever.zet@gmail.com>
  14. */
  15. class PartialNamedSelector extends NamedSelector
  16. {
  17. public function __construct()
  18. {
  19. $this->registerReplacement('%tagTextMatch%', 'contains(normalize-space(string(.)), %locator%)');
  20. $this->registerReplacement('%valueMatch%', 'contains(./@value, %locator%)');
  21. $this->registerReplacement('%titleMatch%', 'contains(./@title, %locator%)');
  22. $this->registerReplacement('%altMatch%', 'contains(./@alt, %locator%)');
  23. $this->registerReplacement('%relMatch%', 'contains(./@rel, %locator%)');
  24. $this->registerReplacement('%labelAttributeMatch%', 'contains(./@label, %locator%)');
  25. parent::__construct();
  26. }
  27. }