I am a quite newbee for phpunit, so it might be stupid though .... I google around but not found.
This is my code and I have multiple API and URL to test.
namespace Acme\TopBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
echo ("first test");
$crawler = $client->request('GET', '/api/getplaceinfo');
$this->assertTrue($client->getResponse()->isSuccessful());
echo ("second test");
echo('test :' + '/api/getmetainfo/kibichuo');
$crawler = $client->request('GET', '/api/getcat');
$this->assertTrue($client->getResponse()->isSuccessful());
echo ("third test");
$crawler = $client->request('GET', '/admin/dashboard');
$this->assertTrue($crawler->filter('html:contains("My Server")')->count() > 0);
}
}
then I test like this (I am using symfony2 framework)
whitebear$ phpunit -c app/
PHPUnit 4.8.35 by Sebastian Bergmann and contributors.
.0
Time: 3.69 seconds, Memory: 109.25MB
OK (1 test, 7 assertions)
There is no message I expected by echo("first test").
So, even error happens, I can't tell which url shows the error.
My basic idea is wrong??
Aucun commentaire:
Enregistrer un commentaire