Last active
December 18, 2015 16:39
-
-
Save demental/5812742 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ActionListTest extends PHPUnit_Framework_TestCase | |
{ | |
public function setup() | |
{ | |
$this->subject = $this->getMock('MOfficeActionLister',array('allActions')); | |
$this->subject->expects($this->any()) | |
->method('allActions') | |
->will($this->mockAllActions()); | |
} | |
public function aSingleAction() { | |
return array( | |
'name' => 'action2', | |
'title' => 'other test title', | |
'batch' => false, | |
'single' => true | |
); | |
} | |
public function aBatchAction() { | |
return array( | |
'name' => 'action1', | |
'title' => 'test title', | |
'batch' => true, | |
'single' => false | |
); | |
} | |
public function mockAllActions() | |
{ | |
return $this->returnValue(array($this->aBatchAction(), $this->aSingleAction())); | |
} | |
public function testSingleActions() | |
{ | |
$this->assertEqual( | |
array($this->aSingleAction()), | |
$this->subject->singleActions() | |
); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe MOfficeActionLister do | |
describe '#singleactions' do | |
let(:a_batch_action) do | |
{ | |
name: 'action1', | |
title: 'test title', | |
batch: true, | |
single: false | |
} | |
end | |
let(:a_single_action) do | |
{ | |
name: 'action2', | |
title: 'another test title', | |
batch: false, | |
single: true | |
} | |
end | |
let(:all_actions) { [a_batch_action, a_single_action] } | |
before { subject.stub(:allActions).and_return all_actions} | |
subject { MOfficeActionLister.new } | |
its(:singleActions) { should eq [a_single_action] } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment