Skip to content

Commit

Permalink
Merge pull request #11 from PrisisForks/master
Browse files Browse the repository at this point in the history
added all tests
  • Loading branch information
prisis committed Jul 28, 2015
2 parents 321cc5c + 8ab961e commit 534791b
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/MockeryWpBridgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,51 @@ public function testMockFunction()
$result = $bridge->fooBar();
$this->assertEquals('baz', $result);
}

public function testAddShortCode()
{
$bridge = new MockeryWpBridge();
$bridge->addShortcode('testshortcode', function() {
return 'test';
});

$this->assertEquals(true, $bridge->hasShortcode('testshortcode'));
$this->assertEquals(false, $bridge->hasShortcode('notestshortcode'));
}

public function testGetShortCode()
{
$func = function() {
return 'test';
};

$bridge = new MockeryWpBridge();
$bridge->addShortcode('testshortcode', $func);

$this->assertSame($func, $bridge->getShortcodeCallback('testshortcode'));
$this->assertEquals(null, $bridge->getShortcodeCallback('notestshortcode'));
}

public function testGetText()
{
$bridge = new MockeryWpBridge();

$this->assertEquals('test', $bridge->__('test', 'MockTest'));
}

public function testShortcodeAtts()
{
$atts = [
'id' => ''
];

$excepted = [
'id' => '1'
];

$bridge = new MockeryWpBridge();
$attr = $bridge->shortcodeAtts($atts, $excepted);

$this->assertEquals($excepted, $attr);
}
}

0 comments on commit 534791b

Please sign in to comment.