Ejemplo n.º 1
0
 public function testEditMyProfile()
 {
     $newFullName = 'James Tiberius Kirk';
     $crawler = $this->getPage('netizen_profile_edit');
     $form = $crawler->selectButton('Save')->form();
     $this->client->submit($form, ['profile' => ['fullName' => $newFullName]]);
     $user = $this->repo->findByNickname('kirk');
     $this->assertEquals($newFullName, $user->getProfile()->fullName);
 }
Ejemplo n.º 2
0
 public function testUnfollowSomebody()
 {
     $crawler = $this->getPage('wall_index', ['wallNick' => 'spock', 'wallFilter' => 'self']);
     $link = $crawler->filter('.netizen')->selectButton('Unfollow')->form();
     $crawler = $this->client->click($link);
     $spock = $this->repo->findByNickname('spock');
     $kirk = $this->repo->findByNickname('kirk');
     // spock has now one follower :
     $this->assertEquals(0, $spock->getFollowerCount());
     // kirk is now following spock :
     $this->assertEquals(0, $kirk->getFollowingCount());
 }
 public function testSendToFollower()
 {
     $current = $this->repo->findByNickname('kirk');
     $follower = $this->repo->findByNickname('spock');
     $follower->follow($current);
     $this->repo->persist($current);
     $this->repo->persist($follower);
     $randomMsg = "Scanning" . rand();
     $crawler = $this->getPage('private_create', ['author' => 'spock']);
     $form = $crawler->filter('.pm-form')->selectButton('Send')->form();
     $crawler = $this->client->submit($form, ['social_private_message' => ['message' => $randomMsg]]);
     $this->assertCount(1, $crawler->filter("div.pm-sent:contains('spock')"));
     $this->assertCount(1, $crawler->filter("div.pm-sent:contains('{$randomMsg}')"));
     return $randomMsg;
 }
Ejemplo n.º 4
0
 public function testCountOnPeriod()
 {
     $cursor = $this->getMockBuilder('MongoCursor')->disableOriginalConstructor()->getMock();
     $cursor->expects($this->once())->method('count');
     $this->repository->expects($this->once())->method('getCursor')->with($this->arrayHasKey('-class'))->willReturn($cursor);
     $this->sut->countOnLastPeriod(123);
 }
Ejemplo n.º 5
0
 /**
  * @depends testUnknownUserGoToRegister
  */
 public function testRegisterUntilPayment()
 {
     $crawler = $this->getPage('trismegiste_oauth_connect');
     $authLink = $this->getConnectLink($crawler, 'dummy');
     $crawler = $this->client->click($authLink);
     $this->assertCurrentRoute('trismegiste_oauth_dummyserver', ['redirect' => $this->generateUrl('trismegiste_oauth_check', ['provider' => 'dummy'])]);
     $oauthForm = $crawler->selectButton('Redirect')->form();
     $crawler = $this->client->submit($oauthForm, ['uid' => '1701', 'nickname' => 'spock']);
     $this->assertCurrentRoute('guest_register');
     $form = $crawler->selectButton('Register')->form();
     $this->client->submit($form, ['netizen_register' => ['nickname' => 'spock', 'gender' => 'xy', 'dateOfBirth' => ['year' => 1984, 'month' => 11, 'day' => 13]]]);
     $this->assertCurrentRoute('buy_new_ticket');
     $user = $this->repo->findByNickname('spock');
     $this->assertEquals('spock', $user->getUsername());
     $this->assertEquals('1701', $user->getCredential()->getUid());
     $token = $this->client->getContainer()->get('security.context')->getToken();
     $this->assertEquals($user, $token->getUser());
 }