Changeset 1739

Show
Ignore:
Timestamp:
07/27/08 23:42:48 (4 months ago)
Author:
mikey
Message:

add tests for alternative instantiation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • framework/trunk/src/main/php/net/stubbles/xml/xsl/stubXSLProcessor.php

    r1737 r1739  
    5858    public function __construct() 
    5959    { 
    60         if (extension_loaded('xsl') == false) { 
     60        if (extension_loaded('xsl') === false) { 
    6161            throw new stubRuntimeException('Can not create ' . __CLASS__ . ', requires PHP-extension "xsl".'); 
    6262        } 
     
    6868     * creates the XSLTProcessor instance 
    6969     */ 
    70     // @codeCoverageIgnoreStart 
    7170    protected function createXSLTProcessor() 
    7271    { 
    7372        $this->xsltProcessor = new XSLTProcessor(); 
    7473    } 
    75     // @codeCoverageIgnoreEnd 
    7674 
    7775    /** 
     
    144142    { 
    145143        $this->stylesheets[] = $stylesheet; 
    146         $this->xsltProcessor->importStylesheet($stylesheet);# 
     144        $this->xsltProcessor->importStylesheet($stylesheet); 
    147145        return $this; 
    148146    } 
  • framework/trunk/src/test/php/net/stubbles/xml/xsl/stubXSLProcessorTestCase.php

    r1737 r1739  
    9595 
    9696    /** 
     97     * test creation with applyStylesheet() 
     98     * 
     99     * @test 
     100     */ 
     101    public function creationWithApplyStylesheet() 
     102    { 
     103        $stylesheet = new DOMDocument(); 
     104        $xslProcessor = stubXSLProcessor::applyStylesheet($stylesheet); 
     105        $this->assertType('stubXSLProcessor', $xslProcessor); 
     106        $this->assertEquals(array($stylesheet), $xslProcessor->getStylesheets()); 
     107    } 
     108 
     109    /** 
     110     * test creation with applyStylesheetFromFile() 
     111     * 
     112     * @test 
     113     */ 
     114    public function creationWithApplyStylesheetFromFile() 
     115    { 
     116        $xslProcessor = stubXSLProcessor::applyStylesheetFromFile(TEST_SRC_PATH . '/resources/xsl/testfile.xsl'); 
     117        $this->assertType('stubXSLProcessor', $xslProcessor); 
     118        $this->assertEquals(1, count($xslProcessor->getStylesheets())); 
     119    } 
     120 
     121    /** 
    97122     * onDocument() should returns its instance 
    98123     *