cacert-testmgr/external/ZendFramework-1.9.5/tests/Zend/Db/Table/Row/StaticTest.php
Markus Warg 8398c9048d initially import ZendFramework-1.9.5 into repository
code was modified slightly, so the code differs from the original downloadable 1.9.5 version
2010-03-31 10:12:32 +02:00

105 lines
3.2 KiB
PHP

<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Db
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id $
*/
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Util/Filter.php';
PHPUnit_Util_Filter::addFileToFilter(__FILE__);
/**
* @see Zend_Db_Table_Row_TestMockRow
*/
require_once dirname(__FILE__) . '/../_files/My/ZendDbTable/Row/TestMockRow.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Db
* @group Zend_Db_Table
* @group Zend_Db_Table_Row
*/
class Zend_Db_Table_Row_StaticTest extends PHPUnit_Framework_TestCase
{
public function testTableRowTransformColumnNotUsedInConstructor()
{
$data = array(
'column' => 'value1',
'column_foo' => 'value2',
'column_bar_baz' => 'value3'
);
$row = new My_ZendDbTable_Row_TestMockRow(array('data' => $data));
$array = $row->toArray();
$this->assertEquals($data, $array);
}
public function testTableRowTransformColumnMagicGet()
{
$data = array(
'column' => 'value1',
'column_foo' => 'value2',
'column_bar_baz' => 'value3'
);
$row = new My_ZendDbTable_Row_TestMockRow(array('data' => $data));
$this->assertEquals('value1', $row->column);
$this->assertEquals('value2', $row->columnFoo);
$this->assertEquals('value3', $row->columnBarBaz);
}
public function testTableRowTransformColumnMagicSet()
{
$data = array(
'column' => 'value1',
'column_foo' => 'value2',
'column_bar_baz' => 'value3'
);
$row = new My_ZendDbTable_Row_TestMockRow(array('data' => $data));
$this->assertEquals('value1', $row->column);
$this->assertEquals('value2', $row->columnFoo);
$this->assertEquals('value3', $row->columnBarBaz);
$row->column = 'another value 1';
$row->columnFoo = 'another value 2';
$row->columnBarBaz = 'another value 3';
$array = $row->toArray();
$this->assertEquals(
array(
'column' => 'another value 1',
'column_foo' => 'another value 2',
'column_bar_baz' => 'another value 3'
), $array);
}
public function getDriver()
{
return 'Static';
}
}