本文整理汇总了PHP中TestReflection类的典型用法代码示例。如果您正苦于以下问题:PHP TestReflection类的具体用法?PHP TestReflection怎么用?PHP TestReflection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestReflection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testConstructorAppliesDefaultConfiguration
/**
* Test JModelAdmin::__construct
*
* @since 3.4
*
* @return void
*
* @testdox Constructor applies default configuration
*/
public function testConstructorAppliesDefaultConfiguration()
{
$config = array('event_after_delete' => 'onContentAfterDelete', 'event_after_save' => 'onContentAfterSave', 'event_before_delete' => 'onContentBeforeDelete', 'event_before_save' => 'onContentBeforeSave', 'event_change_state' => 'onContentChangeState', 'text_prefix' => 'COM_MOCK_J');
foreach ($config as $key => $value) {
$this->assertEquals($value, TestReflection::getValue($this->object, $key));
}
}
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:16,代码来源:JModelAdminTest.php
示例2: testGetInstance
/**
* Test JPathway::getInstance().
*
* @return void
*/
public function testGetInstance()
{
$current = TestReflection::getValue('JApplicationHelper', '_clients');
// Test Client
$obj = new stdClass();
$obj->id = 0;
$obj->name = 'inspector';
$obj->path = JPATH_TESTS;
$obj2 = new stdClass();
$obj2->id = 1;
$obj2->name = 'inspector2';
$obj2->path = __DIR__ . '/stubs';
TestReflection::setValue('JApplicationHelper', '_clients', array($obj, $obj2));
$pathway = JPathway::getInstance('Inspector');
$this->assertThat(get_class($pathway), $this->equalTo('JPathwayInspector'));
$this->assertThat(JPathway::getInstance('Inspector'), $this->equalTo($pathway));
$pathway = JPathway::getInstance('Inspector2');
$this->assertThat(get_class($pathway), $this->equalTo('JPathwayInspector2'));
$ret = true;
try {
JPathway::getInstance('Error');
} catch (Exception $e) {
$ret = false;
}
if ($ret) {
$this->fail('JPathway did not throw proper exception upon false client.');
}
TestReflection::setValue('JApplicationHelper', '_clients', $current);
}
开发者ID:ZerGabriel,项目名称:joomla-platform,代码行数:34,代码来源:JPathwayTest.php
示例3: tearDown
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @return void
*
* @since 3.0
*/
protected function tearDown()
{
TestReflection::setValue('JComponentHelper', 'components', array());
// Restore the state
$this->restoreFactoryState();
parent::tearDown();
}
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:15,代码来源:JHelpTest.php
示例4: testConstructor
/**
* Tests the JImage::__construct method.
*
* @return void
*
* @since 11.4
*/
public function testConstructor()
{
// Create a image handle of the correct size.
$imageHandle = imagecreatetruecolor(100, 100);
$filter = new JImageFilterBrightness($imageHandle);
$this->assertEquals(TestReflection::getValue($filter, 'handle'), $imageHandle);
}
开发者ID:rvsjoen,项目名称:joomla-platform,代码行数:14,代码来源:JImageFilterTest.php
示例5: test_parseArguments
/**
* Test the JInput::parseArguments method.
*
* @dataProvider provider_parseArguments
*/
public function test_parseArguments($inputArgv, $expectedData, $expectedArgs)
{
$_SERVER['argv'] = $inputArgv;
$this->inspector = new JInputCLI(null, array('filter' => new JFilterInputMock()));
$this->assertThat(TestReflection::getValue($this->inspector, 'data'), $this->identicalTo($expectedData));
$this->assertThat(TestReflection::getValue($this->inspector, 'args'), $this->identicalTo($expectedArgs));
}
开发者ID:sural98,项目名称:joomla-cms,代码行数:12,代码来源:JInputCliTest.php
示例6: tearDown
/**
* Overrides the parent tearDown method.
*
* @return void
*
* @see PHPUnit_Framework_TestCase::tearDown()
* @since 11.1
*/
protected function tearDown()
{
// Reset the dispatcher instance.
TestReflection::setValue('JEventDispatcher', 'instance', null);
TestReflection::setValue('JPluginHelper', 'plugins', null);
parent::tearDown();
}
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:15,代码来源:JModelFormTest.php
示例7: create
/**
* Creates and instance of the mock JController object.
*
* @param object $test A test object.
*
* @return object
*
* @since 12.1
*/
public static function create($test)
{
// Collect all the relevant methods in JController.
$methods = array(
'execute',
'getApplication',
'getInput',
'serialize',
'unserialize',
);
// Create the mock.
$mockObject = $test->getMock(
'JControllerBase',
$methods,
// Constructor arguments.
array(),
// Mock class name.
'',
// Call original constructor.
false
);
// TODO Mock the input.
TestReflection::setValue($mockObject, 'input', new JInput);
return $mockObject;
}
开发者ID:robschley,项目名称:joomla-platform,代码行数:37,代码来源:controller.php
示例8: tearDown
/**
* Overrides the parent tearDown method.
*
* @return void
*
* @see PHPUnit_Framework_TestCase::tearDown()
* @since 11.1
*/
protected function tearDown()
{
$this->restoreFactoryState();
// Reset the dispatcher instance.
TestReflection::setValue('JPluginHelper', 'plugins', null);
parent::tearDown();
}
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:15,代码来源:JModelFormTest.php
示例9: tearDown
/**
* Overrides the parent tearDown method.
*
* @return void
*
* @see PHPUnit_Framework_TestCase::tearDown()
* @since 11.1
*/
protected function tearDown()
{
// Reset the loaded plugins.
TestReflection::setValue('JPluginHelper', 'plugins', null);
$this->restoreFactoryState();
$_SERVER = $this->backupServer;
parent::tearDown();
}
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:16,代码来源:JAuthenticationTest.php
示例10: testExtractCustom
/**
* Tests the extractCustom Method.
*
* @return void
*/
public function testExtractCustom()
{
if (!JArchiveZip::isSupported()) {
$this->markTestSkipped('ZIP files can not be extracted.');
}
TestReflection::invoke($this->object, 'extractCustom', __DIR__ . '/logo.zip', $this->outputPath);
$this->assertFileExists($this->outputPath . '/logo-zip.png');
}
开发者ID:klas,项目名称:joomla-cms,代码行数:13,代码来源:JArchiveZipTest.php
示例11: tearDown
/**
* Overrides the parent tearDown method.
*
* @return void
*
* @see PHPUnit_Framework_TestCase::tearDown()
* @since 3.6
*/
protected function tearDown()
{
// Reset the dispatcher instance.
TestReflection::setValue('JEventDispatcher', 'instance', null);
$_SERVER = $this->backupServer;
$this->restoreFactoryState();
parent::tearDown();
}
开发者ID:N6REJ,项目名称:joomla-cms,代码行数:16,代码来源:JLanguageMultilangTest.php
示例12: testGetInput
/**
* Test the getInput method where there is no value from the element
* and no checked attribute.
*
* @param array $data @todo
* @param string $expected @todo
*
* @return void
*
* @since 12.2
*
* @dataProvider getInputData
*/
public function testGetInput($data, $expected)
{
$formField = new JFormFieldEmail();
foreach ($data as $attr => $value) {
TestReflection::setValue($formField, $attr, $value);
}
$this->assertEquals($expected, TestReflection::invoke($formField, 'getInput'), 'Line:' . __LINE__ . ' The field with no value and no checked attribute did not produce the right html');
}
开发者ID:akirsoft,项目名称:joomla-cms,代码行数:21,代码来源:JFormFieldEmailTest.php
示例13: testCacheTimeout
/**
* Overrides TestCaseCache::testCacheTimeout to deal with the adapter's stored time values in this test
*
* @testdox The cache handler correctly handles expired cache data
*
* @medium
*/
public function testCacheTimeout()
{
/** @var Cache_Lite $cacheLiteInstance */
$cacheLiteInstance = TestReflection::getValue('JCacheStorageCachelite', 'CacheLiteInstance');
$cacheLiteInstance->_lifeTime = 0.1;
// For parent class
$this->handler->_lifetime =& $cacheLiteInstance->_lifeTime;
parent::testCacheTimeout();
}
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:16,代码来源:JCacheStorageCacheliteTest.php
示例14: tearDown
/**
* Overrides the parent tearDown method.
*
* @return void
*
* @see PHPUnit_Framework_TestCase::tearDown()
* @since 11.1
*/
protected function tearDown()
{
// Reset the dispatcher instance.
TestReflection::setValue('JEventDispatcher', 'instance', null);
// Reset the loaded plugins.
TestReflection::setValue('JPluginHelper', 'plugins', null);
$_SERVER = $this->backupServer;
parent::tearDown();
}
开发者ID:eshiol,项目名称:joomla-cms,代码行数:17,代码来源:JAuthenticationTest.php
示例15: testGetInput
/**
* Test the getInput method where there is no value from the element.
*
* @param array $data @todo
* @param string $expected @todo
*
* @return void
*
* @since 12.2
*
* @dataProvider getInputData
*/
public function testGetInput($data, $expected)
{
$formField = new JFormFieldTel();
TestReflection::setValue($formField, 'element', simplexml_load_string('<field type="tel" />'));
foreach ($data as $attr => $value) {
TestReflection::setValue($formField, $attr, $value);
}
$this->assertEquals($expected, TestReflection::invoke($formField, 'getInput'), 'Line:' . __LINE__ . ' The field did not produce the right html');
}
开发者ID:SysBind,项目名称:joomla-cms,代码行数:21,代码来源:JFormFieldTelTest.php
示例16: testGetInput
/**
* Test the getInput method.
* @covers JFormFieldTemplateStyle::getGroups
*/
public function testGetInput()
{
$form = new JForm('form1');
$this->assertThat($form->load('<form><field name="templatestyle" type="templatestyle" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
$field = new JFormFieldTemplatestyle($form);
$this->assertThat($field->setup(TestReflection::getValue($form, 'xml')->field, 'value'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true.');
$this->markTestIncomplete('Problems encountered in next assertion');
$this->assertThat(strlen($field->input), $this->greaterThan(0), 'Line:' . __LINE__ . ' The getInput method should return something without error.');
// TODO: Should check all the attributes have come in properly.
}
开发者ID:n3t,项目名称:joomla-platform,代码行数:14,代码来源:JFormFieldTemplateStyleTest.php
示例17: testCacheTimeout
/**
* Overrides TestCaseCache::testCacheTimeout to deal with the adapter's stored time values in this test
*
* @testdox The cache handler correctly handles expired cache data
*
* @medium
*/
public function testCacheTimeout()
{
/** @var Cache_Lite $cacheLiteInstance */
$cacheLiteInstance = TestReflection::getValue('JCacheStorageCachelite', 'CacheLiteInstance');
$cacheLiteInstance->_lifeTime = 2;
$data = 'testData';
$this->assertTrue($this->handler->store($this->id, $this->group, $data), 'Initial Store Failed');
sleep(5);
$this->assertFalse($this->handler->get($this->id, $this->group), 'No data should be returned from the cache store when expired.');
}
开发者ID:N6REJ,项目名称:joomla-cms,代码行数:17,代码来源:JCacheStorageCacheliteTest.php
示例18: create
/**
* Creates and instance of the mock JController object.
*
* @param object $test A test object.
*
* @return object
*
* @since 12.1
*/
public static function create($test)
{
// Collect all the relevant methods in JController.
$methods = array('execute', 'getApplication', 'getInput', 'serialize', 'unserialize');
// Create the mock.
$mockObject = $test->getMock('JControllerBase', $methods, array(), '', false);
// TODO Mock the input.
TestReflection::setValue($mockObject, 'input', new JInput());
return $mockObject;
}
开发者ID:ZerGabriel,项目名称:joomla-platform,代码行数:19,代码来源:controller.php
示例19: testExtractCustom
/**
* Tests the extractCustom Method.
*
* @return void
*/
public function testExtractCustom()
{
if (!JArchiveZip::isSupported()) {
$this->markTestSkipped('ZIP files can not be extracted.');
return;
}
TestReflection::invoke($this->object, 'extractCustom', __DIR__ . '/logo.zip', static::$outputPath);
$this->assertTrue(is_file(static::$outputPath . '/logo-zip.png'));
if (is_file(static::$outputPath . '/logo-zip.png')) {
unlink(static::$outputPath . '/logo-zip.png');
}
}
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:17,代码来源:JArchiveZipTest.php
示例20: testGetInput
/**
* Test the getInput method where there is no value from the element
* and no checked attribute.
*
* @param string $element @todo
* @param array $data @todo
* @param string $expected @todo
*
* @return void
*
* @since 12.2
*
* @dataProvider getInputData
*/
public function testGetInput($element, $data, $expected)
{
$formField = new JFormFieldRadio();
TestReflection::setValue($formField, 'element', simplexml_load_string($element));
foreach ($data as $attr => $value) {
TestReflection::setValue($formField, $attr, $value);
}
// Get the result once, we may perform multiple tests
$result = TestReflection::invoke($formField, 'getInput');
// Test that the tag exists
$matcher = array('id' => 'myTestId');
$this->assertTag($matcher, $result, 'The tag did not have the correct id.');
}
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:27,代码来源:JFormFieldRadioTest.php
注:本文中的TestReflection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论