addPattern("eé"); $this->assertTrue($regex->match("eéêè", $match)); $this->assertEqual($match, "eé"); } function testWithTextInLatin1() { $regex = &new ParallelRegex(false); $regex->addPattern(utf8_decode("eé")); $this->assertTrue($regex->match(utf8_decode("eéêè"), $match)); $this->assertEqual($match, utf8_decode("eé")); } function &createParser() { $parser = &new MockSimpleHtmlSaxParser(); $parser->setReturnValue('acceptStartToken', true); $parser->setReturnValue('acceptEndToken', true); $parser->setReturnValue('acceptAttributeToken', true); $parser->setReturnValue('acceptEntityToken', true); $parser->setReturnValue('acceptTextToken', true); $parser->setReturnValue('ignore', true); return $parser; } function testTagWithAttributesInUTF8() { $parser = &$this->createParser(); $parser->expectOnce('acceptTextToken', array('label', '*')); $parser->expectAt(0, 'acceptStartToken', array('expectAt(1, 'acceptStartToken', array('href', '*')); $parser->expectAt(2, 'acceptStartToken', array('>', '*')); $parser->expectCallCount('acceptStartToken', 3); $parser->expectAt(0, 'acceptAttributeToken', array('= "', '*')); $parser->expectAt(1, 'acceptAttributeToken', array('hère.html', '*')); $parser->expectAt(2, 'acceptAttributeToken', array('"', '*')); $parser->expectCallCount('acceptAttributeToken', 3); $parser->expectOnce('acceptEndToken', array('', '*')); $lexer = &new SimpleHtmlLexer($parser); $this->assertTrue($lexer->parse('label')); } function testTagWithAttributesInLatin1() { $parser = &$this->createParser(); $parser->expectOnce('acceptTextToken', array('label', '*')); $parser->expectAt(0, 'acceptStartToken', array('expectAt(1, 'acceptStartToken', array('href', '*')); $parser->expectAt(2, 'acceptStartToken', array('>', '*')); $parser->expectCallCount('acceptStartToken', 3); $parser->expectAt(0, 'acceptAttributeToken', array('= "', '*')); $parser->expectAt(1, 'acceptAttributeToken', array(utf8_decode('hère.html'), '*')); $parser->expectAt(2, 'acceptAttributeToken', array('"', '*')); $parser->expectCallCount('acceptAttributeToken', 3); $parser->expectOnce('acceptEndToken', array('', '*')); $lexer = &new SimpleHtmlLexer($parser); $this->assertTrue($lexer->parse(utf8_decode('label'))); } } class TestOfUrlithDifferentCharset extends UnitTestCase { function testUsernameAndPasswordInUTF8() { $url = new SimpleUrl('http://pÈrick:penËt@www.lastcraft.com'); $this->assertEqual($url->getUsername(), 'pÈrick'); $this->assertEqual($url->getPassword(), 'penËt'); } } ?>