PHP Classes

File: test/ssa/runner/resolver/impl/DefaultObjectResolverTest.php

Recommend this page to a friend!
  Classes of thomas   SSA   test/ssa/runner/resolver/impl/DefaultObjectResolverTest.php   Download  
File: test/ssa/runner/resolver/impl/DefaultObjectResolverTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: SSA
Call PHP classes from JavaScript on Web pages
Author: By
Last change:
Date: 9 years ago
Size: 1,585 bytes
 

Contents

Class file image Download
<?php

namespace ssa\runner\resolver\impl;

use
ssa\runner\resolver\impl\DefaultObjectResolver;
/**
 * Description of DefaultObjectResolver
 *
 * @author thomas
 */
class DefaultObjectResolverTest extends \PHPUnit_Framework_TestCase {
    private
$objectResolver;
   
    public function
setUp() {
       
$this->objectResolver = new DefaultObjectResolver();
       
$parameterResolver = $this->getMock('ssa\runner\resolver\ParameterResolver',
                                   array(
'resolvePrimitive','resolveObject')
                                );
       
$parameterResolver->expects($this->any())
                          ->
method('resolvePrimitive')
                          ->
will($this->returnValue(12));
       
$parameterResolver->expects($this->any())
                          ->
method('resolveObject')
                          ->
will($this->returnValue((object) array('param1' => 'value1')));
       
       
$this->objectResolver->setParameterResolver($parameterResolver);
    }
   
    public function
testresolveObect() {
       
$type = array('\ssa\runner\resolver\Pojo');
       
$object = $this->objectResolver->resolveObject(
            new \
ReflectionClass('\ssa\runner\resolver\Pojo'),
            array(
               
'param' => 12,
               
'pojo' => array(
                   
'param' => 13
               
)
            ),
           
$type
       
);
       
// not corresponding the parameters because mock
       
$this->assertEquals(12, $object->getParam());
       
$this->assertEquals('value1', $object->getPojo()->param1);
    }
}