Code Search for Developers
 
 
  

live_test.php from Brim at Krugle


Show live_test.php syntax highlighted

<?php
    // $Id: live_test.php 1175 2006-03-16 09:53:09Z barrel $
    require_once(dirname(__FILE__) . '/../unit_tester.php');
    require_once(dirname(__FILE__) . '/../socket.php');
    require_once(dirname(__FILE__) . '/../http.php');
    require_once(dirname(__FILE__) . '/../compatibility.php');

    if (SimpleTest::getDefaultProxy()) {
        SimpleTest::ignore('LiveHttpTestCase');
    }
    
    class LiveHttpTestCase extends UnitTestCase {

        function testBadSocket() {
            $socket = &new SimpleSocket('bad_url', 111, 5);
            $this->assertTrue($socket->isError());
            $this->assertPattern(
                    '/Cannot open \\[bad_url:111\\] with \\[/',
                    $socket->getError());
            $this->assertFalse($socket->isOpen());
            $this->assertFalse($socket->write('A message'));
        }
        
        function testSocketClosure() {
            $socket = &new SimpleSocket('www.lastcraft.com', 80, 15, 8);
            $this->assertTrue($socket->isOpen());
            $this->assertTrue($socket->write("GET /test/network_confirm.php HTTP/1.0\r\n"));
            $socket->write("Host: www.lastcraft.com\r\n");
            $socket->write("Connection: close\r\n\r\n");
            $this->assertEqual($socket->read(), "HTTP/1.1");
            $socket->close();
            $this->assertIdentical($socket->read(), false);
        }
        
        function testRecordOfSentCharacters() {
            $socket = &new SimpleSocket('www.lastcraft.com', 80, 15);
            $this->assertTrue($socket->write("GET /test/network_confirm.php HTTP/1.0\r\n"));
            $socket->write("Host: www.lastcraft.com\r\n");
            $socket->write("Connection: close\r\n\r\n");
            $socket->close();
            $this->assertEqual($socket->getSent(),
                    "GET /test/network_confirm.php HTTP/1.0\r\n" .
                    "Host: www.lastcraft.com\r\n" .
                    "Connection: close\r\n\r\n");
        }
    }
?>



See more files for this project here

Brim

BRIM is a MVC framework, written in PHP and based on items with a hierarchical relationship. The list of plugins make BRIM a Information Manager with plugins like bookmarks, a calendar, contacts tasks, notes, RSS etc. The application is multilingual.

Project homepage: http://sourceforge.net/projects/brim
Programming language(s): JavaScript,PHP,SQL
License: other

  acceptance_test.php
  adapter_test.php
  all_tests.php
  authentication_test.php
  browser_test.php
  collector_test.php
  compatibility_test.php
  cookies_test.php
  detached_test.php
  dumper_test.php
  encoding_test.php
  errors_test.php
  expectation_test.php
  form_test.php
  frames_test.php
  http_test.php
  index.php
  interfaces_test.php
  live_test.php
  mock_objects_test.php
  options_test.php
  page_test.php
  parse_error_test.php
  parser_test.php
  real_sites_test.php
  reflection_php4_test.php
  remote_test.php
  shell_test.php
  shell_tester_test.php
  simple_mock_test.php
  simpletest_test.php
  socket_test.php
  tag_test.php
  test_groups.php
  test_with_parse_error.php
  unit_tester_test.php
  unit_tests.php
  url_test.php
  user_agent_test.php
  visual_test.php
  web_tester_test.php
  xml_test.php