RequireOnceItopFile('/core/metamodel.class.php'); $this->RequireOnceItopFile('/core/coreexception.class.inc.php'); } /** * @covers MetaModel::ApplyParams() * @dataProvider ApplyParamsProvider * * @param string $sInput * @param array $aParams * @param string $sExpectedOutput * * @throws \Exception */ public function testApplyParams($sInput, $aParams, $sExpectedOutput) { $oUserRequest = $this->createObject( 'UserRequest', array( 'org_id' => static::$iDefaultUserOrgId, 'caller_id' => static::$iDefaultUserCallerId, 'title' => static::$sDefaultUserRequestTitle, 'description' => static::$sDefaultUserRequestDescription, ) ); $aParams['this->object()'] = $oUserRequest; $sGeneratedOutput = MetaModel::ApplyParams($sInput, $aParams); $this->assertEquals($sExpectedOutput, $sGeneratedOutput, "ApplyParams test returned $sGeneratedOutput"); } public function ApplyParamsProvider() { $sTitle = static::$sDefaultUserRequestTitle; $aParams = array(); return array( 'Object string attribute (text format)' => array( 'Title: $this->title$', $aParams, 'Title: '.$sTitle, ), 'Object string attribute (html format)' => array( 'Title:

$this->title$

', $aParams, 'Title:

'.$sTitle.'

', ), 'Object string attribute urlencoded (html format)' => array( 'Title: Hyperlink', $aParams, 'Title: Hyperlink', ), ); } }