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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:39:25+00:00 2026-06-13T10:39:25+00:00

I am trying the phpunit in the Zf2 album module by following the online

  • 0

I am trying the phpunit in the Zf2 album module by following the online ZF2 tutorial. Below is the debug information.

Album\Model\AlbumTableTest::testFetchAllReturnsAllAlbums
Argument 1 passed to Album\Model\AlbumTable::__construct() must be an instance of Zend\Db\Adapter\Adapter, instance of Mock_TableGateway_fb3537df given, called in D:\www\zend2\tests\module\Album\src\Album\Model\AlbumTableTest.php on line 26 and defined

And the function used is

public function testFetchAllReturnsAllAlbums()
{
    $resultSet        = new ResultSet();
    $mockTableGateway = $this->getMock('Zend\Db\TableGateway\TableGateway',
                                       array('select'), array(), '', false);
    $mockTableGateway->expects($this->once())
                     ->method('select')
                     ->with()
                     ->will($this->returnValue($resultSet));

    $albumTable = new AlbumTable($mockTableGateway);

    $this->assertSame($resultSet, $albumTable->fetchAll());
}

And the 26th line mentioned in the debug information is

$albumTable = new AlbumTable($mockTableGateway);

Which calls to the following functon in Album\Model\AlbumTable::__construct()

public function __construct(Adapter $adapter)
    {
        $this->adapter = $adapter;
        $this->resultSetPrototype = new ResultSet();
        $this->resultSetPrototype->setArrayObjectPrototype(new Album());
        $this->initialize();
    }

Any help to over come this failed test is much appreciated.

  • 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-13T10:39:26+00:00Added an answer on June 13, 2026 at 10:39 am

    Got it solved. I happened to see that the Album module given in the Zend Framework2 tutorial has been changed. I followed it once again to correct the changed codes. Now the mentioned issue has been sorted out.

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

Sidebar

Related Questions

I am trying out the phpunit in the Zf2 album module. I encountered an
I'm trying to add a custom assert to phpunit, following this tutorial , to
I'm just trying out PHPUnit with CakePHP and i'm getting an the following error
I am trying to get PHPUnit up and running the following are the steps
When trying to do pear install phpunit/PHPUnit I get the following error Failed to
I'm trying to write a unit test with phpunit for a model that uses
I am trying to run PHPUnit test at CakePHP 2.0. There's no problem with
I'm trying to get familiar with PHPUnit testing within Kohana. At the moment, I
I am trying to work out how to configure PHPUnit to use the test
I'm trying to write tests for some legacy code with PHPUnit 3.4.9, but it

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.