Support the ongoing development of Laravel.io →
IOC Packages Testing
Last updated 2 years ago.
0

what does php --version says ? And are you running this with artisan tinker or separately with boris or some other REPL ?

Also paste in the part of codes throwing error.

Last updated 2 years ago.
0

PHP 5.5.11-3+deb.sury.org~precise+1 (cli) (built: Apr 23 2014 12:28:12) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

Class A {
public doSearch($parameters){
    $response = Twitter::getSearch($parameters);
}

in PHPUnit test:

TwitterFacade::shouldReceive('getSearch)');
$this->object->getSearch($parameters);

When I use:

Thujohn\Twitter\TwitterFacade::shouldReceive('getSearch)');
$tweets = $this->object->getSearch($parameters);

I got:

1) ATest::testGetSearch
ErrorException: Non-static method Thujohn\Twitter\TwitterFacade::getSearch() should not be called statically, assuming $this from incompatible context
Last updated 2 years ago.
0

Try removing the ")" from the end of 'getSearch)'.

Last updated 2 years ago.
0

thepsion5 said:

Try removing the ")" from the end of 'getSearch)'.

No, It was not a problem.

I changed code from Twitter::getSearch to $twitter = new Twitter(); $twitter->getSearch() and used mock provided within tests in package folder.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Lechus lechus Joined 1 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.