Print
PHP Unit Testing

PHP client uses SimpleTest for unit testing purposes, so you have to have it installed if you want to run test cases.

Also, the client is tested against ActiveMQ message broker, version 5.1 with the following configuration

<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.org/config/1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.org/config/1.0 http://activemq.apache.org/schema/activemq-core.xsd
  http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

  <!-- Allows us to use system properties as variables in this configuration file -->
  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
  
  <broker xmlns="http://activemq.org/config/1.0" brokerName="localhost" dataDirectory="${activemq.base}/data">
  
    <!-- The transport connectors ActiveMQ will listen to -->
    <transportConnectors>
       <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
       <transportConnector name="stomp+ssl" uri="stomp+ssl://localhost:61612"/>
    </transportConnectors>

    <plugins>
      <simpleAuthenticationPlugin>
        <users>
          <authenticationUser username="system" password="manager"
                              groups="users,admins"/>
          <authenticationUser username="user" password="password"
                              groups="users"/>
          <authenticationUser username="guest" password="password" groups="guests"/>
        </users>
      </simpleAuthenticationPlugin>


      <!--  lets configure a destination based authorization mechanism -->
      <authorizationPlugin>
        <map>
          <authorizationMap>
            <authorizationEntries>
              <authorizationEntry queue=">" read="admins" write="admins" admin="admins" />
              <authorizationEntry queue="USERS.>" read="users" write="users" admin="users" />
              <authorizationEntry queue="GUEST.>" read="guests" write="guests,users" admin="guests,users" />
              
              <authorizationEntry topic=">" read="admins" write="admins" admin="admins" />
              <authorizationEntry topic="USERS.>" read="users" write="users" admin="users" />
              <authorizationEntry topic="GUEST.>" read="guests" write="guests,users" admin="guests,users" />
              
              <authorizationEntry topic="ActiveMQ.Advisory.>" read="guests,users" write="guests,users" admin="guests,users"/>
            </authorizationEntries>
          </authorizationMap>
        </map>
      </authorizationPlugin>
    </plugins>  

  </broker>

</beans>

After setting the testing environment, you can run test cases by simply evaluating an appropriate test script. For example:

php src/test/php4/StompTest.php
Powered by Atlassian Confluence