blob: fb82eeab8ebaf8ac5df8c9ed841d4a51b219da0a [file] [log] [blame]
<?php
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @version //autogentag//
* @filesource
* @package PersistentObject
* @subpackage Tests
*/
/**
* Tests the load facilities of ezcPersistentIdenitySessionOptions.
*
* @package PersistentObject
* @subpackage Tests
*/
class ezcPersistentSessionIdentityDecoratorOptionsTest extends ezcTestCase
{
public static function suite()
{
return new PHPUnit_Framework_TestSuite( __CLASS__ );
}
public function testCtorNoArgs()
{
$opts = new ezcPersistentSessionIdentityDecoratorOptions();
$this->assertFalse(
$opts->refetch
);
}
public function testCtorArgs()
{
$opts = new ezcPersistentSessionIdentityDecoratorOptions(
array( 'refetch' => true )
);
$this->assertTrue(
$opts->refetch
);
}
public function testGetAccessSuccess()
{
$opts = new ezcPersistentSessionIdentityDecoratorOptions();
$this->assertFalse(
$opts->refetch
);
}
public function testGetAccessFailure()
{
$opts = new ezcPersistentSessionIdentityDecoratorOptions();
try
{
echo $opts->fooBar;
$this->fail( 'Exception not thrown on get access to non-existent property.' );
} catch ( ezcBasePropertyNotFoundException $e ) {}
}
public function testIssetAccess()
{
$opts = new ezcPersistentSessionIdentityDecoratorOptions();
$this->assertTrue( isset( $opts->refetch ) );
$this->assertFalse( isset( $opts->fooBar ) );
}
public function testSetAccessSuccess()
{
$opts = new ezcPersistentSessionIdentityDecoratorOptions();
$this->assertSetProperty(
$opts,
'refetch',
array( true, false )
);
}
public function testSetAccessFailure()
{
$opts = new ezcPersistentSessionIdentityDecoratorOptions();
$this->assertSetPropertyFails(
$opts,
'refetch',
array( null, 23, 42.23, 'foo', array(), new stdClass() )
);
}
}
?>