Code Monkey home page Code Monkey logo

Comments (8)

devilcius avatar devilcius commented on August 16, 2024

Try with phpunit tests/Api/ --bootstrap vendor/autoload.php. Let me know if it doesn't work.

from php-last.fm-api.

ColorTwist avatar ColorTwist commented on August 16, 2024

I am using WAMP / Windows.
How exactly should i exactly that?

from php-last.fm-api.

devilcius avatar devilcius commented on August 16, 2024

I presume you have phpunit installed. If not, you can install it with composer composer global require "phpunit/phpunit=5.1.*"
Then open a cmd and run phpunit tests/Api/ --bootstrap vendor/autoload.php from the root of the project.

from php-last.fm-api.

ColorTwist avatar ColorTwist commented on August 16, 2024

Yeah, installed it now. thanks.
It writes:

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\Util\Getopt.php on line 38

Fatal error: Uncaught You must provide a valid api key, api secret, session key and username to test this method!

C:\wamp64\www\PHP-Last.fm-API-master\tests\Api\BaseAuthenticatedApiTest.php:26
C:\wamp64\www\PHP-Last.fm-API-master\tests\Api\AuthenticatedTrackTest.php:22
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:128
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:106

I did provide .env file inside tests/Api/, however, i did not fill:
lastfm_token=
lastfm_session_key=

from php-last.fm-api.

devilcius avatar devilcius commented on August 16, 2024

Fill them with a random string then. All test will pass, except for those that need last.fm token and session key. You should pass around 90% of tests.

from php-last.fm-api.

ColorTwist avatar ColorTwist commented on August 16, 2024

Hey,

I filled token and session with random keys.
I thought i can run tests directly in browsers . Quite new to this methods.

Here is what i get: (i guess some passed):

.........E.......EEEE.............................. 51 / 51 (100%)

Time: 29.36 seconds, Memory: 6.00MB

There were 5 errors:

  1. Tests\Api\ArtistTest::testSimilar
    Error: Cannot use string offset as an array

C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\ArtistApi.php:262
C:\wamp64\www\PHP-Last.fm-API-master\tests\Api\ArtistTest.php:69
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:155
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:106

  1. Tests\Api\AuthenticatedTrackTest::testLoveTrack
    LastFmApi\Exception\ApiFailedException: Invalid session key - Please re-authenticate

C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\BaseApi.php:187
C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\BaseApi.php:261
C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\TrackApi.php:346
C:\wamp64\www\PHP-Last.fm-API-master\tests\Api\AuthenticatedTrackTest.php:32
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:155
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:106

  1. Tests\Api\AuthenticatedTrackTest::testUnloveTrack
    LastFmApi\Exception\ApiFailedException: Invalid session key - Please re-authenticate

C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\BaseApi.php:187
C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\BaseApi.php:261
C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\TrackApi.php:381
C:\wamp64\www\PHP-Last.fm-API-master\tests\Api\AuthenticatedTrackTest.php:42
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:155
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:106

  1. Tests\Api\AuthenticatedTrackTest::testScrobbleASingleTrack
    LastFmApi\Exception\ApiFailedException: Invalid session key - Please re-authenticate

C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\BaseApi.php:187
C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\BaseApi.php:261
C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\TrackApi.php:561
C:\wamp64\www\PHP-Last.fm-API-master\tests\Api\AuthenticatedTrackTest.php:53
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:155
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:106

  1. Tests\Api\AuthenticatedTrackTest::testScrobbleABatchOfTracks
    LastFmApi\Exception\ApiFailedException: Invalid session key - Please re-authenticate

C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\BaseApi.php:187
C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\BaseApi.php:261
C:\wamp64\www\PHP-Last.fm-API-master\src\lastfmapi\Api\TrackApi.php:561
C:\wamp64\www\PHP-Last.fm-API-master\tests\Api\AuthenticatedTrackTest.php:71
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:155
C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:106

Fatal error: Uncaught Error: Call to undefined method PHPUnit_Framework_TestResult::warningCount() in C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\ResultPrinter.php:185
Stack trace:
#0 C:\wamp64\www\PHP-Last.fm-API-master\vendor\phpunit\phpunit\src\TextUI\TestRunner.php(446): PHPUnit_TextUI_ResultPrinter->printResult(Object(PHPUnit_Framework_TestResult))
#1 C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php(155): PHPUnit_TextUI_TestRunner->doRun(NULL, Array)
#2 C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php(106): PHPUnit_TextUI_Command->run(Array, true)
#3 C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\phpunit(47): PHPUnit_TextUI_Command::main()
#4 {main}
thrown in C:\Users\User\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\ResultPrinter.php on line 185

from php-last.fm-api.

devilcius avatar devilcius commented on August 16, 2024

Yes, 46 of 51 passed. 5 failed (those that need the token or session key).

from php-last.fm-api.

ColorTwist avatar ColorTwist commented on August 16, 2024

Thanks.

from php-last.fm-api.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.