for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class LeaguesPageTest extends \TestCase {
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
/**
* Test leagues index page and make sure at least one is found
*/
public function testLeaguesIndexPage() {
$crawler = $this->client->request('GET', route('league.index'));
$this->assertResponseOk();
$this->assertEquals(0, $crawler->filter('.league-info')->count(), 'More than 1 league found');
}
* Make sure admins see their leagues
public function testShowAdminsLeagues() {
$this->be(User::find(1));
$this->getUsersLeagues(1);
* Make sure players see their leagues
public function testShowPlayersLeagues() {
$this->be(User::find(2));
* But not just anyone
public function testShowNewUsersLeagues() {
$new_user = User::create(['username' => 'test']);
$this->be($new_user);
$this->getUsersLeagues(0);
* Check that the user has as many leagues as asked for
*
* @param int $expected
protected function getUsersLeagues($expected = 0) {
$crawler = $this->client->request('GET', route('league.mine'));
$this->assertEquals($expected, $crawler->filter('.league-info')->count(), 'Amount of leagues');
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.