diff options
author | Arron Woods <me@arronwoods.com> | 2013-12-05 22:40:45 +0000 |
---|---|---|
committer | Arron Woods <me@arronwoods.com> | 2013-12-05 22:40:45 +0000 |
commit | ad0e2ffc901c27477bba23bf762215b7e2350d21 (patch) | |
tree | fde2e3020c30110a967142cd879c216538cb33bd | |
parent | e0fd2e51a5546d0d85cf249a6ebf45f9e06e6017 (diff) | |
download | php-ssrs-ad0e2ffc901c27477bba23bf762215b7e2350d21.zip php-ssrs-ad0e2ffc901c27477bba23bf762215b7e2350d21.tar.gz php-ssrs-ad0e2ffc901c27477bba23bf762215b7e2350d21.tar.bz2 |
Tests almost back to passing
-rwxr-xr-x | build.xml | 54 | ||||
-rw-r--r-- | composer.json | 4 | ||||
-rw-r--r-- | composer.lock | 469 | ||||
-rwxr-xr-x | library/SSRS/Object/CatalogItems.php | 2 | ||||
-rwxr-xr-x | library/SSRS/Object/ExecutionInfo.php | 6 | ||||
-rwxr-xr-x | library/SSRS/Object/ReportParameter.php | 1 | ||||
-rwxr-xr-x | library/SSRS/Soap/Exception.php | 2 | ||||
-rwxr-xr-x | library/SSRS/Soap/NTLM.php | 6 | ||||
-rw-r--r-- | tests/bootstrap.php | 3 | ||||
-rwxr-xr-x | tests/library/SSRSTest/Object/AbstractTest.php (renamed from tests/library/SSRS/Object/AbstractTest.php) | 14 | ||||
-rwxr-xr-x | tests/library/SSRSTest/Object/CatalogItemsTest.php (renamed from tests/library/SSRS/Object/CatalogItemsTest.php) | 37 | ||||
-rwxr-xr-x | tests/library/SSRSTest/ReportTest.php (renamed from tests/library/SSRS/ReportTest.php) | 44 | ||||
-rw-r--r-- | tests/library/SSRSTest/ReportTest/LoadReportObject.php (renamed from tests/library/SSRS/ReportTest/LoadReportObject.php) | 15 | ||||
-rwxr-xr-x | tests/library/SSRSTest/ReportTest/ReportExecution2005.wsdl (renamed from tests/library/SSRS/ReportTest/ReportExecution2005.wsdl) | 0 | ||||
-rwxr-xr-x | tests/library/SSRSTest/ReportTest/ReportService2010.wsdl (renamed from tests/library/SSRS/ReportTest/ReportService2010.wsdl) | 0 | ||||
-rwxr-xr-x | tests/library/SSRSTest/Soap/NTLMTest.php (renamed from tests/library/SSRS/Soap/NTLMTest.php) | 31 | ||||
-rwxr-xr-x | tests/phpunit.xml | 5 |
17 files changed, 574 insertions, 119 deletions
@@ -1,60 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <project name="php-ssrs" basedir="." default="app"> - <property name="builddir" value="${ws}/build" /> - - <target name="clean"> - <echo msg="Clean..." /> - <delete dir="${builddir}" /> - </target> - - <target name="prepare"> - <echo msg="Prepare..." /> - <mkdir dir="${builddir}" /> - <mkdir dir="${builddir}/logs" /> - <mkdir dir="${builddir}/logs/coverage" /> - <mkdir dir="${builddir}/docs" /> - </target> - - <!-- Deploy app --> - <target name="app"> - <echo msg="Prepare app..." /> - </target> - - <!-- PHP API Documentation --> - <target name="phpdoc"> - <echo msg="PHP Documentor..." /> - <phpdoc title="API Documentation" - destdir="${builddir}/docs" - sourcecode="yes" - defaultpackagename="php-ssrs" - output="HTML:Smarty:PHP"> - <fileset dir="source"> - <include name="**/*.php" /> - </fileset> - </phpdoc> - </target> - - <!-- PHP copy/paste analysis --> - <target name="phpcpd"> - <echo msg="PHP Copy/Paste..." /> - <exec command="phpcpd --log-pmd '${builddir}/logs/pmd.xml' source" escape="false" /> - </target> - - <!-- PHP dependency checker --> - <target name="pdepend"> - <echo msg="PHP Depend..." /> - <exec command="pdepend --jdepend-xml='${builddir}/logs/jdepend.xml' '${ws}/source'" escape="false" /> - </target> - - <!-- PHP CodeSniffer --> - <target name="phpcs"> - <echo msg="PHP CodeSniffer..." /> - <exec command="phpcs --tab-width=4 --extensions=php --standard=Iw --report=checkstyle '${ws}/source' > '${builddir}/logs/checkstyle.xml'" escape="false" /> - </target> - <!-- Unit Tests & coverage analysis --> <target name="phpunit"> <echo msg="PHP Unit..." /> - <exec command="phpunit --configuration '${ws}/source/tests/phpunit.xml' --log-junit '${builddir}/logs/phpunit.xml' --coverage-clover '${builddir}/logs/coverage/clover.xml' '${ws}/source/tests'" /> + <exec command="phpunit --configuration '${ws}/tests/phpunit.xml' --log-junit '${ws}/logs/phpunit.xml' --coverage-clover '${ws}/logs/coverage/clover.xml' '${ws}/tests'" /> </target> </project> diff --git a/composer.json b/composer.json index 2d672ab..0d50e46 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,10 @@ ], "require": { }, + "require-dev": { + "phpunit/phpunit": "~3.7.", + "mikey179/vfsStream": "*" + }, "autoload": { "psr-0": { "SSRS\\": "library/" diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..4cdc53d --- /dev/null +++ b/composer.lock @@ -0,0 +1,469 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + ], + "hash": "a2acd263f8f7d47dbfa92251cd41341d", + "packages": [ + + ], + "packages-dev": [ + { + "name": "mikey179/vfsStream", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/mikey179/vfsStream.git", + "reference": "063fb10633f10c5ccbcac26227e94f46d9336f90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/063fb10633f10c5ccbcac26227e94f46d9336f90", + "reference": "063fb10633f10c5ccbcac26227e94f46d9336f90", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "org\\bovigo\\vfs\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "homepage": "http://vfs.bovigo.org/", + "time": "2013-04-01 10:41:02" + }, + { + "name": "phpunit/php-code-coverage", + "version": "1.2.13", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", + "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": ">=1.3.0@stable", + "phpunit/php-text-template": ">=1.1.1@stable", + "phpunit/php-token-stream": ">=1.1.3@stable" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*@dev" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2013-09-10 08:14:32" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.3.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "File/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2013-10-10 15:34:57" + }, + { + "name": "phpunit/php-text-template", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5180896f51c5b3648ac946b05f9ec02be78a0b23", + "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "Text/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2012-10-31 18:15:28" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2013-08-02 07:42:54" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5220af2a7929aa35cf663d97c89ad3d50cf5fa3e", + "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2013-09-13 04:58:23" + }, + { + "name": "phpunit/phpunit", + "version": "3.7.28", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d", + "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpunit/php-code-coverage": "~1.2.1", + "phpunit/php-file-iterator": ">=1.3.1", + "phpunit/php-text-template": ">=1.1.1", + "phpunit/php-timer": ">=1.0.4", + "phpunit/phpunit-mock-objects": "~1.2.0", + "symfony/yaml": "~2.0" + }, + "require-dev": { + "pear-pear/pear": "1.9.4" + }, + "suggest": { + "ext-json": "*", + "ext-simplexml": "*", + "ext-tokenizer": "*", + "phpunit/php-invoker": ">=1.1.0,<1.2.0" + }, + "bin": [ + "composer/bin/phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "", + "../../symfony/yaml/" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "http://www.phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2013-10-17 07:27:40" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-text-template": ">=1.1.1@stable" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2013-01-13 10:24:48" + }, + { + "name": "symfony/yaml", + "version": "v2.4.0", + "target-dir": "Symfony/Component/Yaml", + "source": { + "type": "git", + "url": "https://github.com/symfony/Yaml.git", + "reference": "1ae235a1b9d3ad3d9f3860ff20acc072df95b7f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/1ae235a1b9d3ad3d9f3860ff20acc072df95b7f5", + "reference": "1ae235a1b9d3ad3d9f3860ff20acc072df95b7f5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Yaml\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "http://symfony.com", + "time": "2013-11-26 16:40:27" + } + ], + "aliases": [ + + ], + "minimum-stability": "stable", + "stability-flags": [ + + ], + "platform": [ + + ], + "platform-dev": [ + + ] +} diff --git a/library/SSRS/Object/CatalogItems.php b/library/SSRS/Object/CatalogItems.php index 7061e93..6386cd5 100755 --- a/library/SSRS/Object/CatalogItems.php +++ b/library/SSRS/Object/CatalogItems.php @@ -15,7 +15,7 @@ class CatalogItems extends ArrayIterator { $this->data['CatalogItems'] = array(); } - public function setCatalogItems(stdClass $items) { + public function setCatalogItems(\stdClass $items) { foreach ($items->CatalogItem AS $item) { $this->addCatalogItem(new CatalogItem($item)); } diff --git a/library/SSRS/Object/ExecutionInfo.php b/library/SSRS/Object/ExecutionInfo.php index 49e6d15..0a723db 100755 --- a/library/SSRS/Object/ExecutionInfo.php +++ b/library/SSRS/Object/ExecutionInfo.php @@ -11,7 +11,7 @@ class ExecutionInfo extends ObjectAbstract { */ public $executionInfo; - public function __construct(stdClass $info = null) { + public function __construct(\stdClass $info = null) { if ($info) { $this->setData($info->executionInfo); } @@ -27,14 +27,14 @@ class ExecutionInfo extends ObjectAbstract { return strtotime($this->data['ExpirationDateTime']); } - public function setParameters(stdClass $params) { + public function setParameters(\stdClass $params) { return $this->setReportParameters($params); } public function setReportParameters($reportParameters) { $parameters = array(); - if ($reportParameters instanceof stdClass) { + if ($reportParameters instanceof \stdClass) { $reportParameters = isset($reportParameters->ReportParameter) ? $reportParameters->ReportParameter : array(); $reportParameters = is_array($reportParameters) ? $reportParameters : array($reportParameters); } diff --git a/library/SSRS/Object/ReportParameter.php b/library/SSRS/Object/ReportParameter.php index c9f655b..893c427 100755 --- a/library/SSRS/Object/ReportParameter.php +++ b/library/SSRS/Object/ReportParameter.php @@ -49,6 +49,7 @@ class ReportParameter extends ObjectAbstract { if (is_object($value)) { $data[] = new ValidValue((string) $value->Label, (string) $value->Value); } elseif (is_array($value)) { + var_dump($value); $data[] = new ValidValue((string) $value['Label'], (string) $value['Value']); } else { $data[] = new ValidValue((string) $value, (string) $value); diff --git a/library/SSRS/Soap/Exception.php b/library/SSRS/Soap/Exception.php index 2257404..4ee891c 100755 --- a/library/SSRS/Soap/Exception.php +++ b/library/SSRS/Soap/Exception.php @@ -7,7 +7,7 @@ class Exception extends \Exception { public $httpCode; public $response; - public function __construct($message, $code, $response = null) { + public function __construct($message, $code = null, $response = null) { $this->httpCode = $code; $this->response = $response; diff --git a/library/SSRS/Soap/NTLM.php b/library/SSRS/Soap/NTLM.php index 084e92c..3820de8 100755 --- a/library/SSRS/Soap/NTLM.php +++ b/library/SSRS/Soap/NTLM.php @@ -77,11 +77,11 @@ class NTLM extends \SoapClient { $folder = dirname($path); if (!is_dir($folder)) { - throw new SSRS_Soap_Exception('WSDL cache path is not valid'); + throw new Exception('WSDL cache path is not valid'); } if (!is_writeable($folder)) { - throw new SSRS_Soap_Exception('WSDL cache path not writeable'); + throw new Exception('WSDL cache path not writeable'); } $this->_cachePath = $path; @@ -174,4 +174,4 @@ class NTLM extends \SoapClient { return $this->_lastResponse; } -} +}
\ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..1b84a5c --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,3 @@ +<?php + +require(__DIR__ . '/../vendor/autoload.php'); diff --git a/tests/library/SSRS/Object/AbstractTest.php b/tests/library/SSRSTest/Object/AbstractTest.php index 3cfa8f4..e4cd0d9 100755 --- a/tests/library/SSRS/Object/AbstractTest.php +++ b/tests/library/SSRSTest/Object/AbstractTest.php @@ -1,13 +1,17 @@ <?php -class SSRS_Object_AbstractTest extends PHPUnit_Framework_TestCase { +namespace SSRSTest\Object; + +use SSRS\Object\ObjectAbstract; + +class AbstractTest extends \PHPUnit_Framework_TestCase { public function testSetDataWithStdClass() { - $data = new stdClass; + $data = new \stdClass; $data->test1 = 'a'; $data->test2 = 'b'; - $object = new SSRS_Object_Abstract($data); + $object = $this->getMockForAbstractClass('\SSRS\Object\ObjectAbstract', array($data)); $this->assertEquals($data->test1, $object->test1); $this->assertEquals($data->test2, $object->test2); @@ -16,14 +20,14 @@ class SSRS_Object_AbstractTest extends PHPUnit_Framework_TestCase { public function testSetDataWithArray() { $data = array('test1' => 'a', 'test2' => 'b'); - $object = new SSRS_Object_Abstract($data); + $object = $this->getMockForAbstractClass('\SSRS\Object\ObjectAbstract', array($data)); $this->assertEquals($data['test1'], $object->test1); $this->assertEquals($data['test2'], $object->test2); } public function testSetDataWithNull() { - $object = new SSRS_Object_Abstract(); + $object = $this->getMockForAbstractClass('\SSRS\Object\ObjectAbstract'); $this->assertEquals(array(), $object->data); } diff --git a/tests/library/SSRS/Object/CatalogItemsTest.php b/tests/library/SSRSTest/Object/CatalogItemsTest.php index e50df39..554670f 100755 --- a/tests/library/SSRS/Object/CatalogItemsTest.php +++ b/tests/library/SSRSTest/Object/CatalogItemsTest.php @@ -1,18 +1,19 @@ <?php -require_once('SSRS/Object/Abstract.php'); -require_once('SSRS/Object/CatalogItems.php'); -require_once('SSRS/Object/CatalogItem.php'); +namespace SSRSTest\Object; + +use SSRS\Object\CatalogItems; +use SSRS\Object\CatalogItem; /** * Description of CatalogItemsTest * * @author arron */ -class SSRS_Object_CatalogItemsTest extends PHPUnit_Framework_TestCase { +class CatalogItemsTest extends \PHPUnit_Framework_TestCase { public function testSetCatalogItems() { - $catalogItem1 = new stdClass; + $catalogItem1 = new \stdClass; $catalogItem1->ID = '1386fc6d-9c58-489f-adea-081146b62799'; $catalogItem1->Name = 'Reference Report'; $catalogItem1->Path = '/Reports/Reference Report'; @@ -23,14 +24,14 @@ class SSRS_Object_CatalogItemsTest extends PHPUnit_Framework_TestCase { $catalogItem1->CreatedBy = 'MSSQL\WebAccount'; $catalogItem1->ModifiedBy = 'MSSQL\WebAccount'; - $data = new stdClass; - $data->CatalogItems = new stdClass; + $data = new \stdClass; + $data->CatalogItems = new \stdClass; $data->CatalogItems->CatalogItem = array($catalogItem1); - $expected = new SSRS_Object_CatalogItems(); - $expected->addCatalogItem(new SSRS_Object_CatalogItem($catalogItem1)); + $expected = new CatalogItems(); + $expected->addCatalogItem(new CatalogItem($catalogItem1)); - $object = new SSRS_Object_CatalogItems($data); + $object = new CatalogItems($data); $this->assertEquals($expected, $object); } @@ -38,27 +39,27 @@ class SSRS_Object_CatalogItemsTest extends PHPUnit_Framework_TestCase { * @expectedException PHPUnit_Framework_Error */ public function testPassingInvalidObjectToAddCatalogItemThrowsError() { - $object = new SSRS_Object_CatalogItems(); - $object->addCatalogItem(new SSRS_Object_Abstract()); + $object = new CatalogItems(); + $object->addCatalogItem(new \stdClass()); } public function testCatalogItemsEmptyArrayOnInit() { - $object = new SSRS_Object_CatalogItems(); + $object = new CatalogItems(); $this->assertEquals(array(), $object->CatalogItems); } public function testAddCatalogItem() { - $object = new SSRS_Object_CatalogItems(); - $object->addCatalogItem(new SSRS_Object_CatalogItem()); + $object = new CatalogItems(); + $object->addCatalogItem(new CatalogItem()); $this->assertEquals(1, count($object->CatalogItems)); } public function testSetCatalogItemsKeepsCurrentItems() { - $dummy = new stdClass; - $dummy->CatalogItem[] = new SSRS_Object_CatalogItem(); + $dummy = new \stdClass; + $dummy->CatalogItem[] = new CatalogItem(); - $object = new SSRS_Object_CatalogItems(); + $object = new CatalogItems(); $object->setCatalogItems($dummy); $this->assertEquals(1, count($object->CatalogItems)); diff --git a/tests/library/SSRS/ReportTest.php b/tests/library/SSRSTest/ReportTest.php index ec7120e..f46bd69 100755 --- a/tests/library/SSRS/ReportTest.php +++ b/tests/library/SSRSTest/ReportTest.php @@ -2,7 +2,13 @@ namespace SSRSTest; -class ReportTest extends PHPUnit_Framework_TestCase { +use SSRS\Report; +use SSRS\Object\CatalogItems; +use SSRS\Object\ReportOutput; +use SoapVar; +use SoapHeader; + +class ReportTest extends \PHPUnit_Framework_TestCase { public function testPassCredentialsOnConstruct() { $options = array( @@ -10,25 +16,25 @@ class ReportTest extends PHPUnit_Framework_TestCase { 'password' => 'monkhouse' ); - $ssrs = new \SSRS\Report('http://test', $options); + $ssrs = new Report('http://test', $options); $this->assertEquals($options['username'], $ssrs->getUsername()); $this->assertEquals($options['password'], $ssrs->getPassword()); } public function testGetSoapServiceReturnsNTLMByDefault() { - $ssrs = new \SSRS\Report('http://test'); + $ssrs = new Report('http://test'); $soap = $ssrs->getSoapService(false); - $this->assertInstanceOf('\SSRS\Soap_NTLM', $soap); + $this->assertInstanceOf('\SSRS\Soap\NTLM', $soap); $this->assertEquals('http://test/ReportService2010.asmx', $soap->getUri()); } public function testGetSoapExecutionReturnsNTLMByDefault() { - $ssrs = new \SSRS\Report('http://test'); + $ssrs = new Report('http://test'); $soap = $ssrs->getSoapExecution(false); - $this->assertInstanceOf('\SSRS\Soap\NTLM', $soap); + $this->assertInstanceOf('SSRS\Soap\NTLM', $soap); $this->assertEquals('http://test/ReportExecution2005.asmx', $soap->getUri()); } @@ -44,7 +50,7 @@ class ReportTest extends PHPUnit_Framework_TestCase { ->method('__setSoapHeaders') ->with($this->equalTo(array($soapHeader))); - $ssrs = new \SSRS\Report('http://test/ReportServer'); + $ssrs = new Report('http://test/ReportServer'); $ssrs->setSoapExecution($soapMock); $result = $ssrs->setSessionId($sessionId); @@ -53,7 +59,7 @@ class ReportTest extends PHPUnit_Framework_TestCase { public function testLoadChildrenReturnsItemList() { $soapMock = $this->getMockFromWsdl(dirname(__FILE__) . '/ReportTest/ReportService2010.wsdl', 'SoapClientMockChildren'); - $catalogItem1 = new stdClass; + $catalogItem1 = new \stdClass; $catalogItem1->ID = '1386fc6d-9c58-489f-adea-081146b62799'; $catalogItem1->Name = 'Report Reference'; $catalogItem1->Path = '/Reports/Report_Reference'; @@ -64,8 +70,8 @@ class ReportTest extends PHPUnit_Framework_TestCase { $catalogItem1->CreatedBy = 'MSSQL\WebAccount'; $catalogItem1->ModifiedBy = 'MSSQL\WebAccount'; - $return = new stdClass; - $return->CatalogItems = new stdClass; + $return = new \stdClass; + $return->CatalogItems = new \stdClass; $return->CatalogItems->CatalogItem = array($catalogItem1); $soapMock->expects($this->any()) @@ -73,11 +79,11 @@ class ReportTest extends PHPUnit_Framework_TestCase { ->with($this->equalTo(array('ItemPath' => '/Reports', 'Recursive' => true))) ->will($this->returnValue($return)); - $ssrs = new \SSRS\Report('http://test/ReportServer'); + $ssrs = new Report('http://test/ReportServer'); $ssrs->setSoapService($soapMock); $result = $ssrs->listChildren('/Reports', true); - $expected = new \SSRS\Object\CatalogItems($return); + $expected = new CatalogItems($return); $this->assertInstanceOf('\SSRS\Object\CatalogItems', $result); $this->assertEquals($expected, $result); @@ -92,7 +98,7 @@ class ReportTest extends PHPUnit_Framework_TestCase { ->method('ListChildren') ->with($this->equalTo(array('ItemPath' => '/Reports', 'Recursive' => true))); - $ssrs = new \SSRS\Report('http://test/ReportServer'); + $ssrs = new Report('http://test/ReportServer'); $ssrs->setSoapService($soapMock); $result = $ssrs->listChildren('/Reports', $recursiveParam); @@ -105,7 +111,7 @@ class ReportTest extends PHPUnit_Framework_TestCase { ->method('getItemDefinition') ->with($this->equalTo(array('ItemPath' => '/Reports/Managed Account Performance'))); - $ssrs = new \SSRS\Report('http://test/ReportServer'); + $ssrs = new Report('http://test/ReportServer'); $ssrs->setSoapService($soapMock); $result = $ssrs->getItemDefinition('/Reports/Managed Account Performance'); @@ -120,9 +126,9 @@ class ReportTest extends PHPUnit_Framework_TestCase { ->with($this->equalTo(array('Report' => '/Reports/Reference_Report', 'HistoryID' => null))) ->will($this->returnValue($testReport)); - $ssrs = new \SSRS\Report('http://test/ReportServer'); + $ssrs = new Report('http://test/ReportServer'); $ssrs->setSoapExecution($soapMock); - $expected = new \SSRS\Object\Report($testReport); + $expected = new ReportOutput($testReport); $result = $ssrs->loadReport('/Reports/Reference_Report'); $this->assertEquals($expected, $result); @@ -135,11 +141,11 @@ class ReportTest extends PHPUnit_Framework_TestCase { $soapMock->expects($this->any())->method('Render2') ->with($this->equalTo(array( 'Format' => 'HTML4.0', - 'DeviceInfo' => '<DeviceInfo><Toolbar>false</Toolbar></DeviceInfo>', + 'DeviceInfo' => '<DeviceInfo></DeviceInfo>', 'PaginationMode' => 'Estimate' ))); - $ssrs = new \SSRS\Report('http://test/ReportServer'); + $ssrs = new Report('http://test/ReportServer'); $ssrs->setSoapExecution($soapMock) ->setSessionId($executionID); @@ -155,7 +161,7 @@ class ReportTest extends PHPUnit_Framework_TestCase { 'PaginationMode' => 'Another' ))); - $ssrs = new \SSRS\Report('http://test/ReportServer'); + $ssrs = new Report('http://test/ReportServer'); $ssrs->setSoapExecution($soapMock) ->setSessionId('test'); diff --git a/tests/library/SSRS/ReportTest/LoadReportObject.php b/tests/library/SSRSTest/ReportTest/LoadReportObject.php index bb06fe6..e3930ea 100644 --- a/tests/library/SSRS/ReportTest/LoadReportObject.php +++ b/tests/library/SSRSTest/ReportTest/LoadReportObject.php @@ -11,6 +11,7 @@ $param1->Prompt = null; $param1->PromptUser = 1; $param1->ValidValuesQueryBased = null; $param1->DefaultValuesQueryBased = null; +$param1->DefaultValues = new stdClass; $param1->DefaultValues->Value = '0'; $param1->State = 'HasValidValue'; @@ -25,6 +26,7 @@ $param2->Prompt = null; $param2->PromptUser = 1; $param2->ValidValuesQueryBased = null; $param2->DefaultValuesQueryBased = null; +$param2->DefaultValues = new stdClass; $param2->DefaultValues->Value = Array(1, 3, 5, 7, 9, 11, 13, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61); $param2->State = 'HasValidValue'; @@ -48,10 +50,13 @@ $param3->MultiValue = 1; $param3->QueryParameter = 1; $param3->Prompt = null; $param3->PromptUser = 1; +$param3->Dependencies = new stdClass; $param3->Dependencies->Dependency = array('Validation', 'portfolio'); $param3->ValidValuesQueryBased = null; +$param3->ValidValues = new stdClass; $param3->ValidValues->ValidValue = $param3Values; $param3->DefaultValuesQueryBased = null; +$param3->DefaultValues = new stdClass; $param3->DefaultValues->Value = Array(29, 31, 33, 35, 37, 39, 41, 43, 49, 61); $param3->State = 'HasValidValue'; @@ -76,8 +81,10 @@ $param4->QueryParameter = null; $param4->Prompt = null; $param4->PromptUser = 1; $param4->ValidValuesQueryBased = 1; +$param4->ValidValues = new stdClass; $param4->ValidValues->ValidValue = $param4values; $param4->DefaultValuesQueryBased = 1; +$param4->DefaultValues = new stdClass; $param4->DefaultValues->Value = '0'; $param4->State = 'HasValidValue'; @@ -100,10 +107,13 @@ $param5->MultiValue = null; $param5->QueryParameter = 1; $param5->Prompt = 'Date:'; $param5->PromptUser = 1; +$param5->Dependencies = new stdClass; $param5->Dependencies->Dependency = array('managedaccount', 'validation'); $param5->ValidValuesQueryBased = 1; +$param5->ValidValues = new stdClass; $param5->ValidValues->ValidValue = $param5values; $param5->DefaultValuesQueryBased = 1; +$param5->DefaultValues = new stdClass; $param5->DefaultValues->Value = '2011-02-25'; $param5->State = 'HasValidValue'; @@ -116,6 +126,7 @@ $paramArray = array( ); $testReport = new stdClass; +$testReport->executionInfo = new stdClass; $testReport->executionInfo->HasSnapshot = null; $testReport->executionInfo->NeedsProcessing = 1; $testReport->executionInfo->AllowQueryExecution = 1; @@ -124,13 +135,17 @@ $testReport->executionInfo->ParametersRequired = null; $testReport->executionInfo->ExpirationDateTime = '2011-03-08T10:49:43.2934062Z'; $testReport->executionInfo->ExecutionDateTime = '0001-01-01T00:00:00'; $testReport->executionInfo->NumPages = 0; +$testReport->executionInfo->Parameters = new stdClass; $testReport->executionInfo->Parameters->ReportParameter = $paramArray; $testReport->DataSourcePrompts = new stdClass; $testReport->HasDocumentMap = null; $testReport->ExecutionID = 't1mo0x45seatmr451xegqy55'; $testReport->ReportPath = '/Reports/Reference_Report'; +$testReport->ReportPageSetting = new stdClass; +$testReport->ReportPageSetting->PaperSize = new stdClass; $testReport->ReportPageSetting->PaperSize->Height = '210'; $testReport->ReportPageSetting->PaperSize->Width = '277.00000762939'; +$testReport->ReportPageSetting->Margins = new stdClass; $testReport->ReportPageSetting->Margins->Top = '10'; $testReport->ReportPageSetting->Margins->Bottom = '10'; $testReport->ReportPageSetting->Margins->Left = '5'; diff --git a/tests/library/SSRS/ReportTest/ReportExecution2005.wsdl b/tests/library/SSRSTest/ReportTest/ReportExecution2005.wsdl index 02cb5e3..02cb5e3 100755 --- a/tests/library/SSRS/ReportTest/ReportExecution2005.wsdl +++ b/tests/library/SSRSTest/ReportTest/ReportExecution2005.wsdl diff --git a/tests/library/SSRS/ReportTest/ReportService2010.wsdl b/tests/library/SSRSTest/ReportTest/ReportService2010.wsdl index 7eda2a4..7eda2a4 100755 --- a/tests/library/SSRS/ReportTest/ReportService2010.wsdl +++ b/tests/library/SSRSTest/ReportTest/ReportService2010.wsdl diff --git a/tests/library/SSRS/Soap/NTLMTest.php b/tests/library/SSRSTest/Soap/NTLMTest.php index 1fe2897..db0970b 100755 --- a/tests/library/SSRS/Soap/NTLMTest.php +++ b/tests/library/SSRSTest/Soap/NTLMTest.php @@ -10,11 +10,14 @@ * * @author Andrew Lowe */ -require_once('SSRS/Soap/NTLM.php'); -require_once('SSRS/Soap/Exception.php'); -require_once('vfsStream/vfsStream.php'); -class SSRS_Soap_NTLMTest extends PHPUnit_Framework_TestCase { +namespace SSRSTest\Soap; + +use org\bovigo\vfs\vfsStream; +use org\bovigo\vfs\vfsStreamWrapper; +use org\bovigo\vfs\vfsStreamDirectory; + +class NTLMTest extends \PHPUnit_Framework_TestCase { public function testFetchWSDLCallsCurlWithUri() { $arguments = array( @@ -25,7 +28,7 @@ class SSRS_Soap_NTLMTest extends PHPUnit_Framework_TestCase { ) ); - $SOAP = $this->getMock('SSRS_Soap_NTLM', array('callCurl'), $arguments); + $SOAP = $this->getMock('SSRS\Soap\NTLM', array('callCurl'), $arguments); $SOAP->expects($this->once()) ->method('callCurl') @@ -35,29 +38,29 @@ class SSRS_Soap_NTLMTest extends PHPUnit_Framework_TestCase { } public function testSetUsernameReturnsInstance() { - $SOAP = new SSRS_Soap_NTLM('http://'); + $SOAP = new \SSRS\Soap\NTLM('http://'); $result = $SOAP->setUsername('test'); $this->assertEquals($SOAP, $result); - $this->assertInstanceOf('SSRS_Soap_NTLM', $result); + $this->assertInstanceOf('SSRS\Soap\NTLM', $result); } public function testSetPasswordReturnsInstance() { - $SOAP = new SSRS_Soap_NTLM('http://'); + $SOAP = new \SSRS\Soap\NTLM('http://'); $result = $SOAP->setPassword('test1'); $this->assertEquals($SOAP, $result); - $this->assertInstanceOf('SSRS_Soap_NTLM', $result); + $this->assertInstanceOf('SSRS\Soap\NTLM', $result); } /** - * @expectedException SSRS_Soap_Exception + * @expectedException \SSRS\Soap\Exception */ public function testSetCacheThrowsExceptionWithInvalidPath() { vfsStreamWrapper::register(); vfsStreamWrapper::setRoot(new vfsStreamDirectory('tmp')); - $SOAP = new SSRS_Soap_NTLM('http://'); + $SOAP = new \SSRS\Soap\NTLM('http://'); $SOAP->setCachePath(vfsStream::url('tmp/missing/file.wsdl')); } @@ -65,7 +68,7 @@ class SSRS_Soap_NTLMTest extends PHPUnit_Framework_TestCase { vfsStreamWrapper::register(); vfsStreamWrapper::setRoot(new vfsStreamDirectory('tmp')); - $SOAP = new SSRS_Soap_NTLM('http://'); + $SOAP = new \SSRS\Soap\NTLM('http://'); $SOAP->setCachePath(vfsStream::url('tmp/file.wsdl')); $this->assertEquals('vfs://tmp/file.wsdl', $SOAP->getCachePath()); @@ -79,7 +82,7 @@ class SSRS_Soap_NTLMTest extends PHPUnit_Framework_TestCase { vfsStreamWrapper::setRoot(new vfsStreamDirectory('tmp')); $content = 'Hesaklk;k;dfs'; - $SOAP = $this->getMock('SSRS_Soap_NTLM', array('setCacheWSDLPermission'), array('http://')); + $SOAP = $this->getMock('SSRS\Soap\NTLM', array('setCacheWSDLPermission'), array('http://')); $SOAP->expects($this->once()) ->method('setCacheWSDLPermission'); @@ -93,7 +96,7 @@ class SSRS_Soap_NTLMTest extends PHPUnit_Framework_TestCase { public function testCacheWSDLIsWorldWritable() { vfsStreamWrapper::register(); vfsStreamWrapper::setRoot(new vfsStreamDirectory('tmp')); - $SOAP = $this->getMock('SSRS_Soap_NTLM', array('setCacheWSDLPermission'), array('http://')); + $SOAP = $this->getMock('SSRS\Soap\NTLM', array('setCacheWSDLPermission'), array('http://')); $SOAP->expects($this->once()) ->method('setCacheWSDLPermission') diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 91278c2..7ef014d 100755 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -1,5 +1,6 @@ <?xml version="1.0"?> <phpunit + bootstrap="./bootstrap.php" strict="true" stopOnError="false" stopOnFailure="false" @@ -9,11 +10,11 @@ verbose="true" > <testsuites> - <testsuite name="SSRS"> + <testsuite name="SSRSTest"> <directory>.</directory> </testsuite> </testsuites> <php> <includePath>../library</includePath> </php> -</phpunit>
\ No newline at end of file +</phpunit> |