public function test_text_tokens() { $tokens = ppp_set_default_text_tokens(array()); $this->assertEquals(2, count($tokens)); $this->assertEquals('Test Post', ppp_replace_text_tokens('{post_title}', array('post_id' => $this->_post_id))); $this->assertEquals('Test Blog', ppp_replace_text_tokens('{site_title}', array('post_id' => $this->_post_id))); // Test the negative replacements when post_id is missing $this->assertEquals('{post_title}', ppp_post_title_token('{post_title}', array())); }
public function test_token_replacement() { $args = array('post_id' => $this->_post_id); $this->assertEquals('Test Post', ppp_replace_text_tokens('{post_title}', $args)); $this->assertEquals('Test Blog', ppp_replace_text_tokens('{site_title}', $args)); // Test replacing 2 in 1 string $this->assertEquals('Test Post on Test Blog', ppp_replace_text_tokens('{post_title} on {site_title}', $args)); // Test without the post ID to make sure it still returns something $this->assertEquals('{post_title} on Test Blog', ppp_replace_text_tokens('{post_title} on {site_title}', array())); }