Page 1 of 1

Connect to PHPUnit_Framework_TestListener

Posted: Wed Mar 09, 2011 5:48 am
by Blockhead
Greetings. At me a problem with connection of the PHPUnit_Framework_TestListener.
I use phpUnit 3.5.12
Maximum of that has achieved, it is an inscription about the beginning of the test.
Explain how correctly to connect the given class to tests please.

Re: Connect to PHPUnit_Framework_TestListener

Posted: Wed Mar 09, 2011 5:57 am
by Blockhead

Code: Select all

<?php
require_once 'PHPUnit/Framework.php';
 
include 'ArrayTest.php';
require_once 'SimpleTestListener.php';
 
$suite = new PHPUnit_Framework_TestSuite('ArrayTest');
 
$result = new PHPUnit_Framework_TestResult;
$result->addListener(new SimpleTestListener);
 
$suite->run($result);
?>

Code: Select all

<?php
        require_once 'PHPUnit/Framework.php';
        require_once 'Testing/Selenium.php';
         
        class GoogleTest extends PHPUnit_Framework_TestCase
        {
            private $selenium;
            private $test;
         
            public function setUp()
            {
                $this->selenium = new Testing_Selenium("*chrome", "http://www.google.com");
                $this->selenium->start();
            }
         
            public function tearDown()
            {
                $this->selenium->stop();
            }
         
            public function testGoogle()
            {
                $this->selenium->open("/");
                $this->selenium->type("q", "hello world");
                $this->selenium->click("btnG");
                $this->selenium->waitForPageToLoad(10000);
                $this->assertRegExp("/Поиск в Google/", $this->selenium->getTitle());
            }
        }
?>
I use CMD:
phpunit test.php
On an output:
Class GoogleTest could not be found in test3.php.