com phpruntests: Deflate post section done: src/testcase/preconditions/rtIsSectionImplemented.php src/testcase/rtTestConfiguration.php
src/testcase/sections/rtSection.php tests/testcase/rtDeflatePostExecutionTest.php

From: Date: Thu, 30 Apr 2009 20:22:22 +0000
Subject: com phpruntests: Deflate post section done: src/testcase/preconditions/rtIsSectionImplemented.php src/testcase/rtTestConfiguration.php
src/testcase/sections/rtSection.php tests/testcase/rtDeflatePostExecutionTest.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-66500@lists.php.net to get a copy of this message
Commit: 2bd149c6844e397127f58a09d173e19755217584 Author: Zoe Slattery <zoe@php.net> Thu, 30 Apr 2009 20:22:22 +0000 Parents: 7e7f936a45cc98d4ae25c1ac141549a2070550ff Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=2bd149c6844e397127f58a09d173e19755217584 Log: Deflate post section done Changed paths: M src/testcase/preconditions/rtIsSectionImplemented.php M src/testcase/rtTestConfiguration.php M src/testcase/sections/rtSection.php A tests/testcase/rtDeflatePostExecutionTest.php Diff: diff --git a/src/testcase/preconditions/rtIsSectionImplemented.php b/src/testcase/preconditions/rtIsSectionImplemented.php index eb0e09d..a66699b 100644 --- a/src/testcase/preconditions/rtIsSectionImplemented.php +++ b/src/testcase/preconditions/rtIsSectionImplemented.php @@ -18,7 +18,9 @@ class rtIsSectionImplemented implements rtTestPreCondition 'CLEAN' => 'rtCleanSection', 'XFAIL' => 'rtXfailSection', 'GET' => 'rtGetSection', - 'POST' => 'rtPostSection' + 'POST' => 'rtPostSection', + 'GZIP_POST' => 'rtGzipPostSection', + 'DEFLATE_POST' => 'rtDeflatePostSection', ); /** Return the message associated with an unimplemented test section diff --git a/src/testcase/rtTestConfiguration.php b/src/testcase/rtTestConfiguration.php index 8e0f52e..73eb93b 100644 --- a/src/testcase/rtTestConfiguration.php +++ b/src/testcase/rtTestConfiguration.php @@ -66,12 +66,15 @@ class rtTestConfiguration if (array_key_exists('GET', $sections)) { $this->environmentVariables = array_merge($this->environmentVariables, $sections['GET']->getGetVariables()); } - if (array_key_exists('POST', $sections)) { + if (array_key_exists('POST', $sections)) { $this->environmentVariables = array_merge($this->environmentVariables, $sections['POST']->getPostVariables()); } - if (array_key_exists('GZIP_POST', $sections)) { + if (array_key_exists('GZIP_POST', $sections)) { $this->environmentVariables = array_merge($this->environmentVariables, $sections['GZIP_POST']->getPostVariables()); } + if (array_key_exists('DEFLATE_POST', $sections)) { + $this->environmentVariables = array_merge($this->environmentVariables, $sections['DEFLATE_POST']->getPostVariables()); + } } @@ -112,6 +115,9 @@ class rtTestConfiguration if(in_array('GZIP_POST', $sectionHeadings)) { $this->inputFileString = '< '.$sections['GZIP_POST']->getPostFileName(); } + if(in_array('DEFLATE_POST', $sectionHeadings)) { + $this->inputFileString = '< '.$sections['DEFLATE_POST']->getPostFileName(); + } } private function isCgiTest($sectionHeadings) diff --git a/src/testcase/sections/rtSection.php b/src/testcase/sections/rtSection.php index 413528c..5900b9c 100644 --- a/src/testcase/sections/rtSection.php +++ b/src/testcase/sections/rtSection.php @@ -21,6 +21,7 @@ abstract class rtSection 'GET' => 'rtGetSection', 'POST' => 'rtPostSection', 'GZIP_POST' => 'rtGzipPostSection', + 'DEFLATE_POST' => 'rtDeflatePostSection', ); protected $sectionName; diff --git a/tests/testcase/rtDeflatePostExecutionTest.php b/tests/testcase/rtDeflatePostExecutionTest.php new file mode 100644 index 0000000..9062a98 --- /dev/null +++ b/tests/testcase/rtDeflatePostExecutionTest.php @@ -0,0 +1,55 @@ +<?php + +require_once 'PHPUnit/Framework.php'; +require_once dirname(__FILE__) . '../../../src/rtAutoload.php'; + +class rtDeflatePostExecutionTest extends PHPUnit_Framework_TestCase +{ + private $sample_test; + + public function setUp() + { + $this->php = trim(shell_exec("which php")); + $this->php_cgi = trim(shell_exec("which php-cgi")); + + $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests'); + $this->sample_test = $this->path_to_tests . '/sample_deflatepost.phpt'; + } + + public function tearDown() + { + @unlink($this->path-to_tests . '/sample_deflatepost.php'); + } + + public function testFileRun() + { + //Create a new test configuration + $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', $this->php, $this->sample_test)); + $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',$this->php_cgi); + $config->configure(); + + //Retrieve the array of test file names + $testFiles = $config->getSetting('TestFiles'); + + //Read the test file + $testFile = new rtPhpTestFile(); + $testFile->doRead($testFiles[0]); + $testFile->normaliseLineEndings(); + + //Create a new test case + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $config); + + //Setup and set the local environment for the test case + $testCase->executeTest($config); + $output = $testCase->getOutput(); + $status = $testCase->getStatus(); + + $this->assertEquals('It worked!', trim($output)); + $this->assertEquals('', $status['pass']); + + + } +} + +?> +?> \ No newline at end of file

« previous php.qa (#66500) next »