Login   Register  
PHP Classes
elePHPant
Icontem

File: test/WebPower/gcm/server/ResultTest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Christiaan Baartse  >  PHP Google Cloud Messaging Server  >  test/WebPower/gcm/server/ResultTest.php  >  Download  
File: test/WebPower/gcm/server/ResultTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: PHP Google Cloud Messaging Server
Send messages to Android applications using GCM
Author: By
Last change:
Date: 2013-02-26 03:31
Size: 1,035 bytes
 

Contents

Class file image Download
<?php
namespace WebPower\gcm\server;

class 
ResultTest extends \PHPUnit_Framework_TestCase
{
    public function 
testRequiredParameters()
    {
        
$result Result::builder()->build();
        
$this->assertNull($result->getMessageId());
        
$this->assertNull($result->getErrorCodeName());
        
$this->assertNull($result->getCanonicalRegistrationId());
    }

    public function 
testOptionalParameters()
    {
        
$result Result::builder()
            ->
messageId("42")
            ->
errorCode("D'OH!")
            ->
canonicalRegistrationId("108")
            ->
build();

        
$this->assertEquals("42"$result->getMessageId());
        
$this->assertEquals("D'OH!"$result->getErrorCodeName());
        
$this->assertEquals("108"$result->getCanonicalRegistrationId());
        
$toString $result->__toString();
        
$this->assertContains("messageId=42"$toString);
        
$this->assertContains("errorCode=D'OH!"$toString);
        
$this->assertContains("canonicalRegistrationId=108"$toString);
    }
}