Ejemplo n.º 1
0
    public function testTableRowTransformColumnMagicSet()
    {
        $data = array(
            'column'         => 'value1',
            'column_foo'     => 'value2',
            'column_bar_baz' => 'value3'
        );
        $row = new Zend_Db_Table_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);
    }
Ejemplo n.º 2
0
    public function testTableRelationshipsFindManyToManyMagic()
    {
        $row = new Zend_Db_Table_Row_TestMockRow();

        $this->assertNull($row->matchTable);
        $this->assertNull($row->intersectionTable);
        $this->assertNull($row->callerRefRuleKey);
        $this->assertNull($row->matchRefRuleKey);

        $row->findTable1ViaTable2();
        $this->assertEquals('Table1', $row->matchTable);
        $this->assertEquals('Table2', $row->intersectionTable);
        $this->assertNull($row->callerRefRuleKey);
        $this->assertNull($row->matchRefRuleKey);

        $row->findTable3ViaTable4ByRule1();
        $this->assertEquals('Table3', $row->matchTable);
        $this->assertEquals('Table4', $row->intersectionTable);
        $this->assertEquals('Rule1', $row->callerRefRuleKey);
        $this->assertNull($row->matchRefRuleKey);

        $row->findTable5ViaTable6ByRule2AndRule3();
        $this->assertEquals('Table5', $row->matchTable);
        $this->assertEquals('Table6', $row->intersectionTable);
        $this->assertEquals('Rule2', $row->callerRefRuleKey);
        $this->assertEquals('Rule3', $row->matchRefRuleKey);
    }