<?php


include_once(__DIR__ . '/../eclipse.php');
Mock::generate('SimpleSocket');

class TestOfEclipse extends UnitTestCase
{
    public function testPass()
    {
        $listener = new MockSimpleSocket();

        $fullpath = realpath(__DIR__ . '/support/test1.php');
        $testpath = EclipseReporter::escapeVal($fullpath);
        $expected = "{status:\"pass\",message:\"pass1 at [$testpath line 4]\",group:\"$testpath\",case:\"test1\",method:\"test_pass\"}";
        $listener->returnsByValue('write', -1);

        $pathparts = pathinfo($fullpath);
        $filename  = $pathparts['basename'];
        $test      = new TestSuite($filename);
        $test->addFile($fullpath);
        $test->run(new EclipseReporter($listener));
        $this->assertEqual($expected, $listener->output);
    }
}
