コード例 #1
0
    /**
     * Tests that the output process works with objects.
     *
     * There should be no crash from casting errors.
     * @group templateOperators
     * @group attributeOperator
     */
    public function testDisplayVariableWithObject()
    {
        $db = eZDB::instance();

        // STEP 1: Add test folder
        $folder = new ezpObject( "folder", 2 );
        $folder->name = __METHOD__;
        $folder->publish();

        $nodeId = $folder->mainNode->node_id;

        $node = eZContentObjectTreeNode::fetch( $nodeId );
        $attrOp = new eZTemplateAttributeOperator();
        $outputTxt = '';
        $formatterMock = $this->getMock( 'ezpAttributeOperatorFormatterInterface' );
        $formatterMock->expects( $this->any() )
                      ->method( 'line' )
                      ->will( $this->returnValue( __METHOD__ ) );

        try
        {
            $attrOp->displayVariable( $node, $formatterMock, true, 2, 0, $outputTxt );
        }
        catch ( PHPUnit_Framework_Error $e )
        {
            self::fail( "eZTemplateAttributeOperator raises an error when working with objects." );
        }

        self::assertNotNull( $outputTxt, "Output text is empty." );
        // this is an approxmiate test. The output shoudl contain the name of the object it has been generated correctly.
        self::assertContains( __METHOD__, $outputTxt, "There is something wrong with the output of the attribute operator. Object name not found." );
    }
コード例 #2
0
 /**
  * Tests that the output process works with objects.
  * 
  * There should be no crash from casting errors.
  *
  */
 public function testDisplayVariableWithObject()
 {
     $db = eZDB::instance();
     // STEP 1: Add test folder
     $folder = new ezpObject("folder", 2);
     $folder->name = __FUNCTION__;
     $folder->publish();
     $nodeId = $folder->mainNode->node_id;
     $node = eZContentObjectTreeNode::fetch($nodeId);
     $attrOp = new eZTemplateAttributeOperator();
     $outputTxt = '';
     try {
         $attrOp->displayVariable($node, false, true, 2, 0, $outputTxt);
     } catch (PHPUnit_Framework_Error $e) {
         self::fail("eZTemplateAttributeOperator raises an error when working with objects.");
     }
     self::assertNotNull($outputTxt, "Output text is empty.");
     // this is an approxmiate test. The output shoudl contain the name of the object it has been generated correctly.
     self::assertContains(__FUNCTION__, $outputTxt, "There is something wrong with the output of the attribute operator. Object name not found.");
 }
コード例 #3
0
ファイル: ezdebugoperators.php プロジェクト: gggeek/ezdebug
 function objdebug($obj, $showvals = false, $maxdepth = 2, $currdepth = 0)
 {
     $out = '';
     $dumper = new eZTemplateAttributeOperator();
     $dumper->displayVariable($obj, false, $showvals, $maxdepth, $currdepth, $out);
     eZDebug::writeDebug($out);
     return '';
 }