PHP Classes

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

Recommend this page to a friend!
  Classes of thomas   SSA   test/ssa/runner/resolver/impl/ArrayFilePrimitiveResolver.php   Download  
File: test/ssa/runner/resolver/impl/ArrayFilePrimitiveResolver.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: 10 years ago
Size: 2,143 bytes
 

Contents

Class file image Download
<?php

namespace ssa\runner\resolver\impl;


use
ssa\runner\resolver\impl\ArrayFilePrimitiveResolver;

/**
 * Description of ArrayFilePrimitiveResolver
 *
 * @author thomas
 */
class ArrayFilePrimitiveResolverTest extends \PHPUnit_Framework_TestCase {
   
/**
     *
     * @var ArrayFilePrimitiveResolver
     */
   
private $primitiveResolver;
   
    public function
setUp() {
       
$this->primitiveResolver = new ArrayFilePrimitiveResolver();
       
$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('para1' => 'value1')));
       
       
$this->primitiveResolver->setParameterResolver($parameterResolver);
    }
   
   
/**
     * @expectedException \ssa\runner\resolver\TypeNotSupportedException
     */
   
public function testResolvePrimitiveSimpleArray() {
       
$type = array('array');
       
$this->primitiveResolver->resolvePrimitive('test', $type);
    }
   
   
/**
     * @expectedException \ssa\runner\resolver\TypeNotSupportedException
     */
   
public function testResolvePrimitiveArrayNotFile() {
       
$type = array('array','something');
       
$this->primitiveResolver->resolvePrimitive('test', $type);
    }
   
    public function
testResolvePrimitiveArrayPrimitive() {
       
$type = array('array', 'file');
       
$param = array(
           
'error' => array(0,0),
           
'tmp_name' => array('',''),
           
'size' => array(0,0),
           
'name' => array('', ''),
           
'type' => array('', '')
        );
       
$return = $this->primitiveResolver->resolvePrimitive($param, $type);
       
// 12 12 12 12 à cause du mock
       
$this->assertEquals(array(12,12), $return);
    }
   
       
}