com phpruntests: Fixed test to work with refactored rtRuntestsConfiguration.: tests/configuration/preconditions/rtIsPcreLoadedTest.php
tests/configuration/preconditions/rtIsProcOpenAvailableTest.php

From: Date: Tue, 12 May 2009 22:49:40 +0000
Subject: com phpruntests: Fixed test to work with refactored rtRuntestsConfiguration.: tests/configuration/preconditions/rtIsPcreLoadedTest.php
tests/configuration/preconditions/rtIsProcOpenAvailableTest.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-66480@lists.php.net to get a copy of this message
Commit: 9af6ee24b9964a9cee27e21382eaeec43bc4ae01 Author: Stefan Priebsch <spriebsch@php.net> Tue, 12 May 2009 22:49:40 +0000 Parents: c4987809507fb18ebfd0dc73a9a28b405ff0f857 Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=9af6ee24b9964a9cee27e21382eaeec43bc4ae01 Log: Fixed test to work with refactored rtRuntestsConfiguration. Changed paths: M tests/configuration/preconditions/rtIsPcreLoadedTest.php M tests/configuration/preconditions/rtIsProcOpenAvailableTest.php Diff: diff --git a/tests/configuration/preconditions/rtIsPcreLoadedTest.php b/tests/configuration/preconditions/rtIsPcreLoadedTest.php index 2910e76..c15101d 100644 --- a/tests/configuration/preconditions/rtIsPcreLoadedTest.php +++ b/tests/configuration/preconditions/rtIsPcreLoadedTest.php @@ -1,22 +1,52 @@ <?php +/** + * rtIsPcreLoadedTest + * + * @category Testing + * @package RUNTESTS + * @author Zoe Slattery <zoe@php.net> + * @author Stefan Priebsch <spriebsch@php.net> + * @copyright 2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @link http://qa.php.net/ + */ require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; +/** + * Tests for rtIsPcreLoadedTest precondition. + * + * @category Testing + * @package RUNTESTS + * @author Zoe Slattery <zoe@php.net> + * @author Stefan Priebsch <spriebsch@php.net> + * @copyright 2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @link http://qa.php.net/ + */ class rtIsPcreLoadedTest extends PHPUnit_Framework_TestCase { + protected function setUp() + { + $this->preCondition = new rtIsPcreLoaded(); + } + + protected function tearDown() + { + unset($this->preCondition); + } + public function testLoaded() { - $pre = new rtIsPcreLoaded(); - $this->assertTrue($pre->check()); + $runtestsConfiguration = rtRuntestsConfiguration::getInstance(array()); + + $this->assertEquals(extension_loaded('pcre'), $this->preCondition->check($runtestsConfiguration)); } - public function testgetMessage() + public function testGetMessage() { - $pre = new rtIsPcreLoaded(); - $this->assertEquals($pre->getMessage('pcreNotLoaded'), rtText::get('pcreNotLoaded')); + $this->assertEquals($this->preCondition->getMessage('pcreNotLoaded'), rtText::get('pcreNotLoaded')); } - - //Not sure how to check if it's not loaded? } ?> diff --git a/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php b/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php index 21b2d07..94dfb5c 100644 --- a/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php +++ b/tests/configuration/preconditions/rtIsProcOpenAvailableTest.php @@ -1,15 +1,47 @@ <?php +/** + * rtIsProcOpenAvailableTest + * + * @category Testing + * @package RUNTESTS + * @author Zoe Slattery <zoe@php.net> + * @author Stefan Priebsch <spriebsch@php.net> + * @copyright 2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @link http://qa.php.net/ + */ require_once 'PHPUnit/Framework.php'; require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; +/** + * Tests for rtIsProcOpenAvailableTest precondition. + * + * @category Testing + * @package RUNTESTS + * @author Zoe Slattery <zoe@php.net> + * @author Stefan Priebsch <spriebsch@php.net> + * @copyright 2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @link http://qa.php.net/ + */ class rtIsProcOpenAvailableTest extends PHPUnit_Framework_TestCase { - public function testAvailable() + protected function setUp() { - $pre = new rtIsProcOpenAvailable(); + $this->preCondition = new rtIsProcOpenAvailable(); + } + + protected function tearDown() + { + unset($this->preCondition); + } + + public function testCheck() + { + $runtestsConfiguration = rtRuntestsConfiguration::getInstance(array()); - $this->assertTrue($pre->check()); + $this->assertEquals(function_exists('proc_open'), $this->preCondition->check($runtestsConfiguration)); } public function testgetMessage() @@ -18,7 +50,5 @@ class rtIsProcOpenAvailableTest extends PHPUnit_Framework_TestCase $this->assertEquals($pre->getMessage('procOpenNotAvailable'), rtText::get('procOpenNotAvailable')); } - - //Not sure how to check if it is missing? } ?>

« previous php.qa (#66480) next »