public function testEndsWithCaseInsensitive()
 {
     $this->assertTrue(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "LLO"));
     $this->assertTrue(\asm\utils\Utils::endsWithIgnoreCase("HELLO", ""));
     $this->assertTrue(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "LO"));
     $this->assertTrue(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "O"));
     $this->assertTrue(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "ELLO"));
     $this->assertTrue(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "HELLO"));
     $this->assertTrue(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "hello"));
     $this->assertTrue(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "lo"));
     $this->assertFalse(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "HESTR"));
     $this->assertFalse(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "H"));
     $this->assertFalse(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "ALLO"));
     $this->assertFalse(\asm\utils\Utils::endsWithIgnoreCase("HELLO", "Some long string"));
 }
 /**
  * Creates a PluginResponse instance with data parsed from XML (as returned from toXml()).
  * @param SimpleXMLElement $xml
  * @return PluginResponse instance
  * @see toXml()
  */
 private static function fromXml(SimpleXMLElement $xml)
 {
     /** @noinspection PhpUndefinedFieldInspection */
     if ($xml->error) {
         /** @noinspection PhpUndefinedFieldInspection */
         return self::createError((string) $xml->error);
     }
     /** @noinspection PhpUndefinedFieldInspection */
     $output = $xml->output ? (string) $xml->output->file : null;
     $criteria = array();
     /** @noinspection PhpUndefinedFieldInspection */
     foreach ($xml->criterion as $criterion) {
         /** @noinspection PhpUndefinedFieldInspection */
         $criteria[(string) $criterion['name']] = array('passed' => Utils::parseBool((string) $criterion->passed), 'fulfillment' => (int) (string) $criterion->fulfillment, 'details' => (string) $criterion->details);
     }
     return self::create($criteria, $output);
 }
 /**
  * Attempts to find an XML and an XSL filename in the given folder and adds an error if it cannot find them.
  * @param $fromWhere string directory from where to load the files
  * @param $xmlFile string The found XML filename.
  * @param $xslFile string The found XSL filename.
  */
 private function loadFiles($fromWhere, &$xmlFile, &$xslFile)
 {
     $xmlFile = false;
     $xslFile = false;
     $files = \asm\utils\Filesystem::getFiles($fromWhere);
     foreach ($files as $file) {
         if (Utils::endsWith(strtolower($file), ".xml")) {
             if ($xmlFile === false) {
                 $xmlFile = \asm\utils\Filesystem::combinePaths($fromWhere, $file);
             } else {
                 $this->addError("There are two or more .xml files in your submission. There must only be one.");
             }
         }
         if (Utils::endsWith(strtolower($file), ".xsl")) {
             if ($xslFile === false) {
                 $xslFile = \asm\utils\Filesystem::combinePaths($fromWhere, $file);
             } else {
                 $this->addError("There are two or more .xsl files in your submission. There must only be one.");
             }
         }
     }
     if ($xmlFile === false) {
         $this->addError("Your submission must contain an XML file ending with '.xml'.");
     }
     if ($xslFile === false) {
         $this->addError("Your submission must contain an XSL file ending with '.xsl'.");
     }
 }