IPv4Test.php 747 B

12345678910111213141516171819202122232425
  1. <?php
  2. // IPv4 test case is spliced from Feyd's IPv6 implementation
  3. // we ought to disallow non-routable addresses
  4. class HTMLPurifier_AttrDef_URI_IPv4Test extends HTMLPurifier_AttrDefHarness
  5. {
  6. function test() {
  7. $this->def = new HTMLPurifier_AttrDef_URI_IPv4();
  8. $this->assertDef('127.0.0.1'); // standard IPv4, loopback, non-routable
  9. $this->assertDef('0.0.0.0'); // standard IPv4, unspecified, non-routable
  10. $this->assertDef('255.255.255.255'); // standard IPv4
  11. $this->assertDef('300.0.0.0', false); // standard IPv4, out of range
  12. $this->assertDef('124.15.6.89/60', false); // standard IPv4, prefix not allowed
  13. $this->assertDef('', false); // nothing
  14. }
  15. }
  16. // vim: et sw=4 sts=4