Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7563925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:47:17+00:00 2026-05-30T13:47:17+00:00

I am struggling to set up the code coverage. What must i do, how

  • 0

I am struggling to set up the code coverage.
What must i do, how do i set this up so i can get a coverage map/report please?

I have a unit test that runs. What checkboxes must i check under: Post-build actions?
Must i install a plugin? The unit test is in php 5.3.2 and i run symfony 1.4.5

in cibuild script i run:

php "test/unit/RbcTest.php"

and here the actual test code:

<?php
  require_once dirname(__FILE__).'/../bootstrap/unit.php';
  require_once 'PHP/CodeCoverage/Autoload.php';
  set_include_path ('phoenix/lib/');
  $coverage = new PHP_CodeCoverage;
  $coverage->start('strtolowerTest.php');
  $coverage->stop();
  $writer = new PHP_CodeCoverage_Report_Clover;
  $writer->process($coverage, 'phoenix/test/clover.xml');
  $writer = new PHP_CodeCoverage_Report_HTML;
  $writer->process($coverage, 'phoenix/test/code-coverage-report');
?>

<?php //strtolowerTest.php
echo "1. for strlower";
require_once 'phoenix/lib/vendor/symfony/lib/vendor/lime/lime.php';
echo "2. for strlower";
require_once 'phoenix/lib/validator/myValidatorString.class.php';
echo "3. for strlower";
require_once 'phoenix/lib/vendor/symfony/lib/validator/sfValidatorString.class.php';
$t = new lime_test(2,  new lime_output_color());
$t->is(myValidatorString::doCleanEmail('blabla-32.mtmail..com'), 'blabla@mtmail.com');
$t->is(myValidatorString::doClean('@#*+??%^!~blabla-===32.mtmail..com'), 'blabla@mtmail.com');
$t->is(myValidatorString::slugify('sensio   labs'), 'sensio-labs');
$t->is(myValidatorString::slugify('paris,france'), 'paris-france');
$t->is(myValidatorString::slugify('  sensio'), 'sensio');
$t->is(myValidatorString::slugify('sensio  '), 'sensio');
$t->is(myValidatorString::slugify(''), 'n-a', '::slugify() converts the empty string to n-a');
$t->is(myValidatorString::slugify(' - '), 'n-a', '::slugify() converts a string that only contains non-ASCII characters to n-a');

$t->diag('hello world');
$t->ok(true, 'test something');
?> 

please help
thanks

Here are the output when i view the console build in jenkins:

PHPUnit 3.6.10 by Sebastian Bergmann.

Class test/phpunit/unit/RbcTest could not be found in /var/lib/jenkins/workspace/b32b733b59ba6be9884da7427bee5c95/phoenix/test/phpunit/unit/RbcTest.php.Publishing Clover coverage report...
Publishing Clover HTML report...
Publishing Clover XML report...
Publishing Clover coverage results...
Code coverage enforcement failed for the following metrics:
    Methods
    Conditionals
Setting Build to unstable.
Build step 'Publish Clover Coverage Report' changed build result to UNSTABLE
Publishing Clover coverage report...
Publishing Clover XML report...
Publishing Clover coverage results...
Code coverage enforcement failed for the following metrics:
    Methods
Setting Build to unstable.
[ci-game] evaluating rule: Build result
[ci-game] evaluating rule: Increased number of failed tests
[ci-game] evaluating rule: Increased number of passed tests
[ci-game] evaluating rule: Decreased number of failed tests
[ci-game] evaluating rule: Decreased number of passed tests
[ci-game] evaluating rule: PMD violation
[ci-game] evaluating rule: pylint violation
[ci-game] evaluating rule: CPD violation
[ci-game] evaluating rule: Checkstyle violation
[ci-game] evaluating rule: FindBugs violation
[ci-game] evaluating rule: FXCop violation
[ci-game] evaluating rule: Simian violation
[ci-game] evaluating rule: StyleCop violation
[ci-game] evaluating rule: HIGH priority PMD warnings
[ci-game] evaluating rule: NORMAL priority PMD warnings
[ci-game] evaluating rule: LOW priority PMD warnings
[ci-game] evaluating rule: Changed number of compiler warnings
[ci-game] evaluating rule: Changed number of checkstyle warnings
Finished: UNSTABLE



 <?php
 class myValidatorString extends sfValidatorString
 {
    static public function slugify($text)
   {
       echo "in myvalidatorstring for class sfValidatorString.class.php";
       // replace all non letters or digits by -
       $text = preg_replace('/\W+/', '-', $text);

       // trim and lowercase
       $text = strtolower(trim($text, '-'));

       if (empty($text))
       {
        return 'n-a';
       }
       return $text;
   }
 }

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:47:19+00:00Added an answer on May 30, 2026 at 1:47 pm

    PHP by itself does not generate code coverage information. The Xdebug extension will collect which lines are executed while a script runs, but it won’t create reports. You should use PHPUnit with PHP_CodeCoverage to run your tests and output the report that Jenkins can make available.

    Use pecl to install Xdebug and pear for the other two. You should also take a look at Template for Jenkins Jobs for PHP Projects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Struggling with this one. I have set up a basic email/enquiry form for a
I am struggling with the code when I run it I get this error.
Been struggling with this simple selector problem a couple of hours now and must
This code is from an Access 2007 project I've been struggling with. The actual
I'm working with a set of legacy DAO code that returns an IList, where
I struggling with a problem I have in TSQL, I need to get the
Been struggling with this for a couple days now. Here's the set up -
I am struggling on something that, I am sure, should be easy. I have
I'm struggling... used google and have come up with no answers to this one!
Using ASP.NET MVC 3, I have been struggling to set the selected value for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.