Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

Repository::pushCriteria() does not exist on this mock object #77

@vdomah

Description

@vdomah

Running tests got this error:

BadMethodCallException: Method Mockery_0_App_Repositories_ProductRepository::pushCriteria() does not exist on this mock object

Making mock like that
$this->productRepository = \Mockery::mock('App\Repositories\ProductRepository');

In the same time
$this->productRepository->shouldReceive('paginate')
doesn't give errors

More code:

public function setUp()
{
parent::setUp();
$this->productRepository = m::mock('App\Repositories\ProductRepository');
$this->variantRepository = m::mock('App\Repositories\VariantRepository');
$this->request = m::mock('Illuminate\Http\Request');
$this->productController = new \App\Http\Controllers\Admin\ProductController($this->productRepository, $this->variantRepository);
}
public function tearDown()
{
m::close();
parent::tearDown();
}

public function testIndex()
{
    $this->productRepository->shouldReceive('paginate')->once()->andReturn(array());
    $response = $this->productController->getIndex($this->request);
    $this->assertEqual(array(), $response);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions