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 7847657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:58:29+00:00 2026-06-02T17:58:29+00:00

I’m developing an API and I’m having trouble writing some of the testcases. I

  • 0

I’m developing an API and I’m having trouble writing some of the testcases.
I have already written a group of general testcases to test all entities. These include the general operations such as create, modify and delete.

/**
 * @dataProvider provideCreateData
 * @depends LoginTest::testLogin
 */
public function testCreate

 /**
 * @dataProvider provideModifyData
 * @depends testCreate
 */
function testModify

The dataproviders provide a list of API entities along with their respective attribute, the tests dynamically test all entities without us having to main the tests when there are future changes.

The above currently works fine but I’m having trouble integrating the other needed tests that are hardcoded, for things such as search-functions that don’t follow a general pattern.
Obviously I can’t test a find function without existing entities and as such the find test needs to run after the create test, which I’m having trouble doing. I tried using:

 /**
 * @depends GeneralTest::testCreate 
 */
public function testFind() {}

Which doesn’t work, the test doesn’t run and is instead skipped for no obvious reason. However the test is run if i remove the dependency, but then I can no longer guarantee that there will exist entities in the database.

I feel like I’m missing something obvious, or maybe I misunderstood some important concept.

  • 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-02T17:58:30+00:00Added an answer on June 2, 2026 at 5:58 pm

    There are a couple of reasons a consumer test would be skipped.

    1. ‘testFind’ is defined before ‘GeneralTest::testCreate’. PHPUnit does not change the order of execution to help a dependency; that is on you.
    2. An assertion in ‘GeneralTest::testCreate’ failed. If an assertion fails, the dependency has not been met so the method is skipped.

    You should only use @depends if you really need to. You should strive to have each test method test a specific path of execution. If you think you need that dependency, you’ll need to configure a test suite so that you can control the order of the tests.

    https://phpunit.de/manual/3.7/en/organizing-tests.html#organizing-tests.xml-configuration

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I have a text area in my form which accepts all possible characters from
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have some data like this: 1 2 3 4 5 9 2 6
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.