PageRenderTime 46ms CodeModel.GetById 42ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/unit/WindowsAzure/Blob/Models/CreateContainerOptionsTest.php

https://bitbucket.org/skudatech/azure-sdk-for-php
PHP | 142 lines | 54 code | 21 blank | 67 comment | 0 complexity | 7f8179199822b0ae3c9d8c4c2c6e29a2 MD5 | raw file
  1<?php
  2
  3/**
  4 * LICENSE: Licensed under the Apache License, Version 2.0 (the "License");
  5 * you may not use this file except in compliance with the License.
  6 * You may obtain a copy of the License at
  7 * http://www.apache.org/licenses/LICENSE-2.0
  8 *
  9 * Unless required by applicable law or agreed to in writing, software
 10 * distributed under the License is distributed on an "AS IS" BASIS,
 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12 * See the License for the specific language governing permissions and
 13 * limitations under the License.
 14 * 
 15 * PHP version 5
 16 *
 17 * @category  Microsoft
 18 * @package   Tests\Unit\WindowsAzure\Blob\Models
 19 * @author    Azure PHP SDK <azurephpsdk@microsoft.com>
 20 * @copyright 2012 Microsoft Corporation
 21 * @license   http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 22 * @link      https://github.com/windowsazure/azure-sdk-for-php
 23 */
 24
 25namespace Tests\Unit\WindowsAzure\Blob\Models;
 26use WindowsAzure\Blob\Models\CreateContainerOptions;
 27use WindowsAzure\Common\Internal\InvalidArgumentTypeException;
 28
 29/**
 30 * Unit tests for class CreateContainerOptions
 31 *
 32 * @category  Microsoft
 33 * @package   Tests\Unit\WindowsAzure\Blob\Models
 34 * @author    Azure PHP SDK <azurephpsdk@microsoft.com>
 35 * @copyright 2012 Microsoft Corporation
 36 * @license   http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 37 * @version   Release: @package_version@
 38 * @link      https://github.com/windowsazure/azure-sdk-for-php
 39 */
 40class CreateContainerOptionsTest extends \PHPUnit_Framework_TestCase
 41{
 42    /**
 43     * @covers WindowsAzure\Blob\Models\CreateContainerOptions::getPublicAccess
 44     */
 45    public function testGetPublicAccess()
 46    {
 47        // Setup
 48        $properties = new CreateContainerOptions();
 49        $expected = 'blob';
 50        $properties->setPublicAccess($expected);
 51        
 52        // Test
 53        $actual = $properties->getPublicAccess();
 54        
 55        // Assert
 56        $this->assertEquals($expected, $actual);
 57    }
 58    
 59    /**
 60     * @covers WindowsAzure\Blob\Models\CreateContainerOptions::setPublicAccess
 61     */
 62    public function testSetPublicAccess()
 63    {
 64        // Setup
 65        $properties = new CreateContainerOptions();
 66        $expected = 'container';
 67        
 68        // Test
 69        $properties->setPublicAccess($expected);
 70        
 71        // Assert
 72        $actual = $properties->getPublicAccess();
 73        $this->assertEquals($expected, $actual);
 74    }
 75    
 76    /**
 77     * @covers WindowsAzure\Blob\Models\CreateContainerOptions::setPublicAccess
 78     */
 79    public function testSetPublicAccessInvalidValueFail()
 80    {
 81        // Setup
 82        $properties = new CreateContainerOptions();
 83        $expected = new \DateTime();
 84        $this->setExpectedException(get_class(new InvalidArgumentTypeException('')));
 85        
 86        // Test
 87        $properties->setPublicAccess($expected);
 88    }
 89    
 90    /**
 91     * @covers WindowsAzure\Blob\Models\CreateContainerOptions::setMetadata
 92     */
 93    public function testSetMetadata()
 94    {
 95        // Setup
 96        $container = new CreateContainerOptions();
 97        $expected = array('key1' => 'value1', 'key2' => 'value2');
 98        
 99        // Test
100        $container->setMetadata($expected);
101        
102        // Assert
103        $this->assertEquals($expected, $container->getMetadata());
104    }
105    
106    /**
107     * @covers WindowsAzure\Blob\Models\CreateContainerOptions::getMetadata
108     */
109    public function testGetMetadata()
110    {
111        // Setup
112        $container = new CreateContainerOptions();
113        $expected = array('key1' => 'value1', 'key2' => 'value2');
114        $container->setMetadata($expected);
115        
116        // Test
117        $actual = $container->getMetadata();
118        
119        // Assert
120        $this->assertEquals($expected, $actual);
121    }
122    
123    /**
124     * @covers WindowsAzure\Blob\Models\CreateContainerOptions::addMetadata
125     */
126    public function testAddMetadata()
127    {
128        // Setup
129        $container = new CreateContainerOptions();
130        $key = 'key1';
131        $value = 'value1';
132        $expected = array($key => $value);
133        
134        // Test
135        $container->addMetadata($key, $value);
136        
137        // Assert
138        $this->assertEquals($expected, $container->getMetadata());
139    }
140}
141
142