Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Testing on Windows Guide

xuezhai edited this page May 31, 2013 · 17 revisions

Install PHP and libraries

  1. Install PHP via the Web Platform Installer. choose PHP from SDK list, then click the download arrow for Windows, it should download PHP 5.3.24 and Azure Emulators and its other dependent products, it will install the PHP runtime to C:\Program Files (x86)\IIS Express\PHP\v5.3

  2. Add the install folder to your path.

  3. Setup error reporting to easily debug test failures. Edit the php.ini file in the install folder, changing the values of the following properties:

error_reporting = E_ALL | E_STRICT
display_errors = on
display_startup_errors = on
  1. Install, upgrade and configure PEAR. From the PEAR instructions:

  2. Request go-pear.phar in your browser and save the output to a local file go-pear.pharat php runtime path

  3. From an administrator command prompt, run

    php go-pear.phar
    
  4. Select system for the system|local

  5. Type enter for all the questions.

  6. When go-pear.phar is completed, a new file PEAR_ENV.reg will be created. Run the file to register environment variables for the administrator.

  7. Run the PEAR_ENV.reg from a normal command prompt so the normal user can access PEAR.

  8. Reboot so the environment variables will be applied.

  9. Install required libraries from an administrator command prompt:

pear clear-cache
pear config-set preferred_state beta
pear config-set auto_discover 1
pear install http_request2
pear install mail_mime
pear install Mail_mimeDecode
pear install pear.phpunit.de/PHPUnit
pear install pear.phpqatools.org/phpqatools pear.netpirates.net/phpDox
pear channel-discover pear.bovigo.org
pear install bovigo/vfsStream-beta
pear channel-discover pear.phpdoc.org
pear install phpdoc/phpDocumentor-alpha
  1. Install Git for Windows from here.

  2. Create test folder and Download PHP SDK source code via Git

    From Git Bash, type the following command

    git clone https://github.com/WindowsAzure/azure-sdk-for-php.git
    

    If need to switch to dev branch, type command

    cd azure-sdk-for-php
    git checkout dev
    
  3. Install xDebug. Follow the instructions from the installation wizard.

Configure Windows Azure Credentials

The unit test requires authenticated access of Windows Azure, a few environment variables need to be configured on the test box to enable unit test to get authorized properly. The envrionment variables should be set up like this:

REM Storage
set AZURE_STORAGE_ACCOUNT=jcooketest
set AZURE_STORAGE_KEY=cLA1oIj4L4nElnK6IdPqHppsglpBiVX...

REM Service Bus
set SERVICE_BUS_NAMESPACE=jcooketest
set WRAP_AUTHENTICATION_NAME=owner
set WRAP_PASSWORD=CgXCeMjmTpx74...

REM Service Management
set SERVICE_MANAGEMENT_CERTIFICATE_PATH=C:/Users/jcooke/Desktop/PHPCert1.pem
set SERVICE_MANAGEMENT_COMPLEX_PACKAGE_CONFIGURATION=http://jcooketest2.blob.core.windows.net/deployment/ServiceConfiguration.Cloud.cscfg
set SERVICE_MANAGEMENT_COMPLEX_PACKAGE_URL=http://jcooketest2.blob.core.windows.net/deployment/WindowsAzureProject2.cspkg
set SERVICE_MANAGEMENT_SIMPLE_PACKAGE_CONFIGURATION=http://jcooketest2.blob.core.windows.net/deployment/SimpleServiceConfiguration.Cloud.cscfg
set SERVICE_MANAGEMENT_SIMPLE_PACKAGE_URL=http://jcooketest2.blob.core.windows.net/deployment/SimplePackage.cspkg
set SERVICE_MANAGEMENT_SUBSCRIPTION_ID=c4a9870f-...

Configure Windows Azure Accounts

For the tests to work properly, each service that is tested should be empty. For example, the blob service should have no blobs or containers, there should be no queues, etc.

TODO: Explain how to set up the SERVICE_MANAGEMENT_* variables.

Running the tests

From a command prompt in the azure-sdk-for-php folder, run:

REM Run the main unit tests
phpunit -c phpunit.xml.dist
REM Run the extended integration tests
phpunit -c phpunit.functional.xml.dist
Clone this wiki locally