Skip to content

Commit

Permalink
Fix conflict with Symfony 4.3:
Browse files Browse the repository at this point in the history
PHP Fatal error:  Cannot redeclare static
Liip\FunctionalTestBundle\Test\WebTestCase::$client as non static
Acme\Controller\DefaultControllerTest::$client in
tests/Controller/DefaultControllerTest.php on line 8
  • Loading branch information
alexislefebvre committed Jun 2, 2019
1 parent 89f2ad8 commit fec067e
Showing 1 changed file with 59 additions and 59 deletions.
118 changes: 59 additions & 59 deletions tests/Controller/DefaultControllerTest.php
Expand Up @@ -9,11 +9,11 @@ class DefaultControllerTest extends WebTestCase
{
use FixturesTrait;

private $client = null;
private $testClient = null;

public function setUp()
{
$this->client = static::makeClient();
$this->testClient = static::makeClient();
}

public function testNoTweets()
Expand All @@ -22,7 +22,7 @@ public function testNoTweets()

$path = '/';

$crawler = $this->client->request('GET', $path);
$crawler = $this->testClient->request('GET', $path);

// <body>
$this->assertSame(1,
Expand All @@ -45,13 +45,13 @@ public function testTweets($path = null)
$path = '/';
}

$this->client->enableProfiler();
$this->testClient->enableProfiler();

$crawler = $this->client->request('GET', $path);
$crawler = $this->testClient->request('GET', $path);

$this->assertStatusCode(200, $this->client);
$this->assertStatusCode(200, $this->testClient);

if ($profile = $this->client->getProfile()) {
if ($profile = $this->testClient->getProfile()) {
$this->assertEquals(5,
$profile->getCollector('db')->getQueryCount());
} else {
Expand Down Expand Up @@ -150,13 +150,13 @@ public function testTweetsPages()

$path = '/sinceId/15';

$this->client->enableProfiler();
$this->testClient->enableProfiler();

$crawler = $this->client->request('GET', $path);
$crawler = $this->testClient->request('GET', $path);

$this->assertStatusCode(200, $this->client);
$this->assertStatusCode(200, $this->testClient);

if ($profile = $this->client->getProfile()) {
if ($profile = $this->testClient->getProfile()) {
$this->assertEquals(4,
$profile->getCollector('db')->getQueryCount());
} else {
Expand Down Expand Up @@ -203,7 +203,7 @@ public function testTweetsPages()
->attr('href');

// Previous page
$crawler = $this->client->request('GET', $previousPage);
$crawler = $this->testClient->request('GET', $previousPage);

// Tweet
$this->assertSame(
Expand All @@ -214,7 +214,7 @@ public function testTweetsPages()
);

// Next page
$crawler = $this->client->request('GET', $nextPage);
$crawler = $this->testClient->request('GET', $nextPage);

// Tweet
$this->assertSame(
Expand All @@ -241,7 +241,7 @@ public function testTweetsPages()
)
->eq(4)->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

// Tweet
$this->assertSame(
Expand All @@ -254,7 +254,7 @@ public function testTweetsPages()
// Go to last page
$path = '/sinceId/38';

$crawler = $this->client->request('GET', $path);
$crawler = $this->testClient->request('GET', $path);

// Tweet
$this->assertSame(
Expand All @@ -274,7 +274,7 @@ public function testTweetsPages()
// Go to first page
$path = '/';

$crawler = $this->client->request('GET', $path);
$crawler = $this->testClient->request('GET', $path);

// Tweet
$this->assertSame(
Expand Down Expand Up @@ -302,13 +302,13 @@ public function testCookie()

$path = '/sinceId/'.$tweetId;

$this->client->enableProfiler();
$this->testClient->enableProfiler();

$this->client->request('GET', $path);
$this->testClient->request('GET', $path);

$this->assertStatusCode(200, $this->client);
$this->assertStatusCode(200, $this->testClient);

if ($profile = $this->client->getProfile()) {
if ($profile = $this->testClient->getProfile()) {
$this->assertEquals(5,
$profile->getCollector('db')->getQueryCount());
} else {
Expand All @@ -318,7 +318,7 @@ public function testCookie()
}

// Test the cookie
$cookieJar = $this->client->getCookieJar();
$cookieJar = $this->testClient->getCookieJar();

$this->assertNotNull(
$cookieJar
Expand All @@ -338,11 +338,11 @@ public function testCookie()

$path = '/sinceId/'.$nextTweetId;

$this->client->request('GET', $path);
$this->testClient->request('GET', $path);

// Test that the cookie has been updated to the second tweet in
// the database (but first on this page)
$cookieJar = $this->client->getCookieJar();
$cookieJar = $this->testClient->getCookieJar();

$this->assertEquals(
49664,
Expand All @@ -352,11 +352,11 @@ public function testCookie()
// Reset the cookie
$path = '/resetCookie';

$this->client->followRedirects();
$this->testClient->followRedirects();

$this->client->request('GET', $path);
$this->testClient->request('GET', $path);

$cookieJar = $this->client->getCookieJar();
$cookieJar = $this->testClient->getCookieJar();

// Test that the cookie is now the first tweet
$this->assertEquals(
Expand All @@ -365,11 +365,11 @@ public function testCookie()
);

// Test the redirection
$this->client->followRedirects(false);
$this->testClient->followRedirects(false);

$this->client->request('GET', $path);
$this->testClient->request('GET', $path);

$this->assertTrue($this->client->getResponse()->isRedirect());
$this->assertTrue($this->testClient->getResponse()->isRedirect());
}

public function testDeleteTweets()
Expand Down Expand Up @@ -402,13 +402,13 @@ public function testDeleteTweets()
count($medias)
);

$this->client->enableProfiler();
$this->testClient->enableProfiler();

$crawler = $this->client->request('GET', $path);
$crawler = $this->testClient->request('GET', $path);

$this->assertStatusCode(200, $this->client);
$this->assertStatusCode(200, $this->testClient);

if ($profile = $this->client->getProfile()) {
if ($profile = $this->testClient->getProfile()) {
$this->assertEquals(4,
$profile->getCollector('db')->getQueryCount());
} else {
Expand All @@ -435,9 +435,9 @@ public function testDeleteTweets()

$link = $crawler->filter('a#tweets-delete')->link();

$this->client->followRedirects(true);
$this->testClient->followRedirects(true);

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

// Count deleted tweets
$this->assertContains(
Expand Down Expand Up @@ -480,14 +480,14 @@ public function testDeleteTweets()
count($medias)
);

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

$link = $crawler
->filter('ul.pagination > li > a:contains("Next")')
->eq(0)
->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

// Image
$this->assertSame(1,
Expand Down Expand Up @@ -520,18 +520,18 @@ public function testDeleteTweets()
count($medias)
);

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

$link = $crawler
->filter('ul.pagination > li > a:contains("Next")')
->eq(0)
->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

$link = $crawler->filter('a#tweets-delete')->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

// Count deleted tweets
$this->assertContains(
Expand Down Expand Up @@ -560,11 +560,11 @@ public function testDeleteTweets()
// Delete all the tweets except the last
$path = '/sinceId/40';

$crawler = $this->client->request('GET', $path);
$crawler = $this->testClient->request('GET', $path);

$link = $crawler->filter('a#tweets-delete')->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

// Count deleted tweets
$this->assertContains(
Expand Down Expand Up @@ -619,13 +619,13 @@ public function testHideRetweetedTweets()

$this->assertTrue($retweeted_tweet->isInTimeline());

$this->client->enableProfiler();
$this->testClient->enableProfiler();

$crawler = $this->client->request('GET', $path);
$crawler = $this->testClient->request('GET', $path);

$this->assertStatusCode(200, $this->client);
$this->assertStatusCode(200, $this->testClient);

if ($profile = $this->client->getProfile()) {
if ($profile = $this->testClient->getProfile()) {
$this->assertEquals(4,
$profile->getCollector('db')->getQueryCount());
} else {
Expand All @@ -647,13 +647,13 @@ public function testHideRetweetedTweets()
$link = $crawler->filter('a:contains("Mark as read")')
->eq(1)->link();

$this->client->followRedirects(true);
$this->testClient->followRedirects(true);

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

$this->assertStringEndsWith(
'/sinceId/20',
$this->client->getRequest()->getUri()
$this->testClient->getRequest()->getUri()
);

// Number of displayed Tweets
Expand All @@ -667,7 +667,7 @@ public function testHideRetweetedTweets()
// Delete old tweets
$link = $crawler->filter('a#tweets-delete')->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

// Count deleted tweets
$this->assertEquals(
Expand Down Expand Up @@ -710,11 +710,11 @@ public function testHideRetweetedTweets()
$link = $crawler->filter('a:contains("Mark as read")')
->eq(1)->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

$this->assertStringEndsWith(
'/sinceId/30',
$this->client->getRequest()->getUri()
$this->testClient->getRequest()->getUri()
);

// Number of displayed Tweets
Expand All @@ -737,7 +737,7 @@ public function testHideRetweetedTweets()
// Delete old tweets
$link = $crawler->filter('a#tweets-delete')->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

// Tweet has been hidden
$retweeted_tweet = $em
Expand Down Expand Up @@ -774,17 +774,17 @@ public function testHideRetweetedTweets()
$link = $crawler->filter('a:contains("Mark as read")')
->eq(1)->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

$this->assertStringEndsWith(
'/sinceId/40',
$this->client->getRequest()->getUri()
$this->testClient->getRequest()->getUri()
);

// Delete old tweets
$link = $crawler->filter('a#tweets-delete')->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

// Number of displayed Tweets
$this->assertSame(
Expand Down Expand Up @@ -812,17 +812,17 @@ public function testHideRetweetedTweets()
$link = $crawler->filter('a:contains("Mark as read")')
->eq(1)->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

$this->assertStringEndsWith(
'/sinceId/50',
$this->client->getRequest()->getUri()
$this->testClient->getRequest()->getUri()
);

// Delete old tweets
$link = $crawler->filter('a#tweets-delete')->link();

$crawler = $this->client->click($link);
$crawler = $this->testClient->click($link);

// Number of displayed Tweets
$this->assertSame(
Expand Down

0 comments on commit fec067e

Please sign in to comment.