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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:50:24+00:00 2026-06-11T13:50:24+00:00

I want to write unit tests for a CakePHP shell that I’m creating, but

  • 0

I want to write unit tests for a CakePHP shell that I’m creating, but they aren’t mentioned in the testing documentation or bake:

---------------------------------------------------------------
Bake Tests
Path: /home/brad/sites/farmlogs/app/Test/
---------------------------------------------------------------
---------------------------------------------------------------
Select an object type:
---------------------------------------------------------------
1. Model
2. Controller
3. Component
4. Behavior
5. Helper
Enter the type of object to bake a test for or (q)uit (1/2/3/4/5/q) 

Since CakePHP doesn’t appear to have a default shell testing setup, what should the structure of my basic shell tests look like?

  • 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-11T13:50:26+00:00Added an answer on June 11, 2026 at 1:50 pm

    Judging from examples in Mark Story’s AssetCompress and the CakeDC’s Migrations, just mimic the directory structure for other tests:

    Test/
      Case/
        Console/
          Command/
            Task/
              MyShellTaskTest.php
            MyShellTest.php
    

    Your tests can just extend the CakeTestCase object, just like any other generic test:

    class MyShellTest extends CakeTestCase {
    }
    

    If needed, you can override the base shell, just like you would do with a Controller test:

    class TestMyShell extends MyShell {
    }
    

    Nothing all that special, just stick with the conventions.

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

Sidebar

Related Questions

I do write unit tests while writing APIs and core functionalities. But I want
I want to write a few unit tests that do not make any changes
I have some Web API methods that I want to write unit tests for.
I want to write some unit tests for an interceptor that intercepts the Loggable
I want to write unit tests with NUnit that hit the database. I'd like
I've written an auction system in Django. I want to write unit tests but
I'm writing some unit tests in UnitTest++ and want to write a bunch of
I want to write a unit test for a Django manage.py command that does
I want to write unit tests for a module file I created and put
I want to write some unit tests for my COM object using googletest. Unfortunately

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.