cvs: pear /Services_Yadis/tests AllTests.php TestConfiguration.php.dist TestHelper.php /Services_Yadis/tests/Yadis AllTests.php XrdsTest.php
/Services_Yadis/tests/Yadis/Xrds AllTests.php NamespaceTest.php
| From: | Pádraic Brady | Date: | Sun, 30 Sep 2007 14:26:04 +0000 |
| Subject: | cvs: pear /Services_Yadis/tests AllTests.php TestConfiguration.php.dist TestHelper.php /Services_Yadis/tests/Yadis AllTests.php XrdsTest.php /Services_Yadis/tests/Yadis/Xrds AllTests.php NamespaceTest.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-48731@lists.php.net to get a copy of this message | ||
padraic Sun Sep 30 14:26:04 2007 UTC
Added files:
/pear/Services_Yadis/tests AllTests.php TestConfiguration.php.dist
TestHelper.php
/pear/Services_Yadis/tests/Yadis AllTests.php XrdsTest.php
/pear/Services_Yadis/tests/Yadis/Xrds AllTests.php
NamespaceTest.php
Log:
* Let's add some tests!
http://cvs.php.net/viewvc.cgi/pear/Services_Yadis/tests/AllTests.php?view=markup&rev=1.1
Index: pear/Services_Yadis/tests/AllTests.php
+++ pear/Services_Yadis/tests/AllTests.php
<?php
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'AllTests::main');
}
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'TestHelper.php';
require_once 'Yadis/AllTests.php';
class AllTests
{
public static function main()
{
$parameters = array();
if (TESTS_GENERATE_REPORT && extension_loaded('xdebug')) {
$parameters['reportDirectory'] = TESTS_GENERATE_REPORT_TARGET;
}
PHPUnit_TextUI_TestRunner::run(self::suite(), $parameters);
}
public static function suite()
{
$suite = new PHPUnit_Framework_TestSuite('PEAR - Services_Yadis');
$suite->addTestSuite(Yadis_AllTests::suite());
return $suite;
}
}
if (PHPUnit_MAIN_METHOD == 'AllTests::main') {
AllTests::main();
}
http://cvs.php.net/viewvc.cgi/pear/Services_Yadis/tests/TestConfiguration.php.dist?view=markup&rev=1.1
Index: pear/Services_Yadis/tests/TestConfiguration.php.dist
+++ pear/Services_Yadis/tests/TestConfiguration.php.dist
<?php
define('TESTS_GENERATE_REPORT', false);
define('TESTS_GENERATE_REPORT_TARGET', '/path/to/target');
http://cvs.php.net/viewvc.cgi/pear/Services_Yadis/tests/TestHelper.php?view=markup&rev=1.1
Index: pear/Services_Yadis/tests/TestHelper.php
+++ pear/Services_Yadis/tests/TestHelper.php
<?php
error_reporting( E_ALL );
date_default_timezone_set('Europe/London');
$prRoot = dirname(dirname(__FILE__));
$prTests = $prRoot . DIRECTORY_SEPARATOR . 'tests';
set_include_path($prRoot . PATH_SEPARATOR
. $prTests . PATH_SEPARATOR
. get_include_path());
if (is_readable($prTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
require_once 'TestConfiguration.php';
} else {
require_once 'TestConfiguration.php.dist';
}
http://cvs.php.net/viewvc.cgi/pear/Services_Yadis/tests/Yadis/AllTests.php?view=markup&rev=1.1
Index: pear/Services_Yadis/tests/Yadis/AllTests.php
+++ pear/Services_Yadis/tests/Yadis/AllTests.php
<?php
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Yadis_AllTests::main');
}
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TestHelper.php';
require_once 'XrdsTest.php';
require_once 'Xrds/AllTests.php';
class Yadis_AllTests
{
public static function main()
{
$parameters = array();
if (TESTS_GENERATE_REPORT && extension_loaded('xdebug')) {
$parameters['reportDirectory'] = TESTS_GENERATE_REPORT_TARGET;
}
PHPUnit_TextUI_TestRunner::run(self::suite(), $parameters);
}
public static function suite()
{
$suite = new PHPUnit_Framework_TestSuite('PEAR - Services_Yadis/Yadis');
$suite->addTestSuite(Yadis_Xrds_AllTests::suite());
$suite->addTestSuite('Services_Yadis_XrdsTest');
return $suite;
}
}
if (PHPUnit_MAIN_METHOD == 'Yadis_AllTests::main') {
AllTests::main();
}
http://cvs.php.net/viewvc.cgi/pear/Services_Yadis/tests/Yadis/XrdsTest.php?view=markup&rev=1.1
Index: pear/Services_Yadis/tests/Yadis/XrdsTest.php
+++ pear/Services_Yadis/tests/Yadis/XrdsTest.php
<?php
require_once 'Services/Yadis/Xrds.php';
require_once 'PHPUnit/Framework/TestCase.php';
class Services_Yadis_XrdsTest extends PHPUnit_Framework_TestCase
{
protected $_namespace = null;
public function setUp()
{
$this->_namespace = $this->getMock('Services_Yadis_Xrds_Namespace');
}
public function test()
{
}
}
http://cvs.php.net/viewvc.cgi/pear/Services_Yadis/tests/Yadis/Xrds/AllTests.php?view=markup&rev=1.1
Index: pear/Services_Yadis/tests/Yadis/Xrds/AllTests.php
+++ pear/Services_Yadis/tests/Yadis/Xrds/AllTests.php
<?php
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Yadis_Xrds_AllTests::main');
}
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
require_once 'NamespaceTest.php';
class Yadis_Xrds_AllTests
{
public static function main()
{
$parameters = array();
if (TESTS_GENERATE_REPORT && extension_loaded('xdebug')) {
$parameters['reportDirectory'] = TESTS_GENERATE_REPORT_TARGET;
}
PHPUnit_TextUI_TestRunner::run(self::suite(), $parameters);
}
public static function suite()
{
$suite = new PHPUnit_Framework_TestSuite('PEAR - Services_Yadis/Yadis/Xrds');
$suite->addTestSuite('Services_Yadis_Xrds_NamespaceTest');
return $suite;
}
}
if (PHPUnit_MAIN_METHOD == 'Yadis_Xrds_AllTests::main') {
AllTests::main();
}
http://cvs.php.net/viewvc.cgi/pear/Services_Yadis/tests/Yadis/Xrds/NamespaceTest.php?view=markup&rev=1.1
Index: pear/Services_Yadis/tests/Yadis/Xrds/NamespaceTest.php
+++ pear/Services_Yadis/tests/Yadis/Xrds/NamespaceTest.php
<?php
require_once 'Services/Yadis/Xrds/Namespace.php';
require_once 'PHPUnit/Framework/TestCase.php';
class Services_Yadis_Xrds_NamespaceTest extends PHPUnit_Framework_TestCase
{
public function testInitialState()
{
$name = new Services_Yadis_Xrds_Namespace;
$this->assertEquals(array('xrds' => 'xri://$xrds','xrd'
=> 'xri://$xrd*($v*2.0)'), $name->getNamespaces());
}
public function testAddNamespace()
{
$name = new Services_Yadis_Xrds_Namespace;
$name->addNamespace('test', 'http://example.com/test');
$this->assertEquals('http://example.com/test',
$name->getNamespace('test'));
}
public function testAddNamespaces()
{
$initial = array(
'xrds' => 'xri://$xrds',
'xrd' => 'xri://$xrd*($v*2.0)'
);
$spaces = array(
'test'=>'http://example.com/test',
'test2'=>'http://example.com/test'
);
$name = new Services_Yadis_Xrds_Namespace;
$name->addNamespaces($spaces);
$this->assertEquals($initial + $spaces, $name->getNamespaces());
}
// tests that if provider changes namespaces, our code's XPath can still
// substitute the prior prefix
public function testRegisterXpathNamespaces()
{
$string = <<<XML
<a xmlns:t2="http://example.com/t">
<b>
<t2:c>text</t2:c>
</b>
</a>
XML;
$xml = new SimpleXMLElement($string);
$name = new Services_Yadis_Xrds_Namespace;
$name->addNamespace('t', 'http://example.com/t');
$name->registerXpathNamespaces($xml);
$c = $xml->xpath('//t:c');
$this->assertEquals('text', (string) $c[0]);
}
}