public function test_post() { include 'CssParser.php'; $parser = new CssParser(); $parser->load_file('/home/travis/build/phpBB3/phpBB/ext/anavaro/postlove/styles/all/theme/default.css'); $parser->parse(); $this->login(); // Test creating topic and post to test $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); $post2 = $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test [b]post[/b] posted by the testing framework.'); $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); //Do we see the static? $class = $crawler->filter('#p' . $post2['post_id'])->filter('.postlove')->filter('span')->attr('class'); $this->assertContains('heart-red-16.png', $parser->parsed['main']['.' . $class]['background']); $this->assertContains('0 x', $crawler->filter('#p' . $post2['post_id'])->filter('.postlove')->text()); //toggle like $url = $crawler->filter('#p' . $post2['post_id'])->filter('.postlove')->filter('a')->attr('href'); $crw1 = self::request('GET', substr($url, 1), array(), array(), array('CONTENT_TYPE' => 'application/json')); //reload page and test ... $crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}"); $class = $crawler->filter('#p' . $post2['post_id'])->filter('.postlove')->filter('span')->attr('class'); $this->assertContains('heart-white-16.png', $parser->parsed['main']['.' . $class]['background']); $this->assertContains('1 x', $crawler->filter('#p' . $post2['post_id'])->filter('.postlove')->text()); $this->logout(); }