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

  • SEARCH
  • Home
  • 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 8419271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:33:48+00:00 2026-06-10T02:33:48+00:00

I have an abstract class Exception in custom namespace which has no abstract methods.

  • 0

I have an abstract class Exception in custom namespace which has no abstract methods. All methods are shown as covered by its tests (mocked in a standard way). The reason to make it abstract is unimportant.

Then I have about 10 classes that extend Exception but don’t add or override any methods, properties, constants, etc. It is obvious that all of them should be covered too, but they are shown as not fully covered. I read the docs and googled for a while but didn’t find the answer.

  • PHP_CodeCoverage 1.1.3
  • PHPUnit 3.6.12
  • PHP 5.4.4
  • Xdebug 2.2.1-5.4-vc9

While annotating with @codeCoverageIgnore is a solution I want to find out why it happens this way rather then get 100% coverage.

UPD: sources.

————- abstract class ———-

namespace Jade\Core\Base;


abstract class Exception extends \Exception {
    /**
     * Additional info for exception
     * @var array|null
     */
    protected $info;

    public function __construct($message, array $info = null, $code = 0, \Exception $previous = null) {
        parent::__construct($message, $code, $previous);
        $this->info = $info;
    }

    /**
     * Get the Exception additional info
     * @return mixed
     */
    public function getInfo() {
        return $this->info;
    }
}

————- Tests for abstract class ———-

class ExceptionTest extends \PHPUnit_Framework_TestCase {
    /**
     * @covers \Jade\Core\Base\Exception
     *
     * @group  public
     */
    public function testGetInfo() {
        $info = array('info' => 'test');
        $stub = $this->getMockForAbstractClass('\Jade\Core\Base\Exception', array('message', $info));

        $this->assertEquals($info, $stub->getInfo());
    }

    /**
     * @covers \Jade\Core\Base\Exception
     *
     * @group  public
     */
    public function testConstructWithDefaultInfo() {
        $stub = $this->getMockForAbstractClass('\Jade\Core\Base\Exception', array('message'));
        $this->assertEmpty($stub->getInfo());
    }
}

————- class that extends abstract class ———-

namespace Jade\Core\Exceptions;


class Dict extends \Jade\Core\Base\Exception {
}

Code coverage tool output

Update

Renaming \Jade\Core\Base\Exception to avoid possible collision with \Exception didn’t help (i tried \Jade\Core\Base\Ixception).

Making Exception class a regular class, not abstract also didn’t help.

  • 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-06-10T02:33:49+00:00Added an answer on June 10, 2026 at 2:33 am

    The problem was entirely in class autoloading. To get work i had to manually include files with classes sources in bootstrap file.

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

Sidebar

Related Questions

I have created an abstract base class Animal which has public virtual abstract method
Hey I have an abstract class named Partition which is a functor, and its
So basically, I have an abstract class which has a unique, incremental ID -
Suppose we have abstract class A (all examples in C#) public abstract class A
I have abstract BaseController, which basically looks like below: public abstract class BaseController :
I have an abstract class that has a virtual method. The method is virtual
I have one abstract class -let's say myBase. And I want all the classes
I have the following abstract class which CAN NOT be changed. public abstract class
I have a generic class with the methods being defined as under public abstract
It's the first time I use java Rmi*. I have a custom class which

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.