public function __construct() { // stubs chain should return this agency $agency = new \Bpi\ApiBundle\Domain\Aggregate\Agency('200100', self::AGENCY_NAME, 'moderator', 'public_key', 'secret'); $repository = $this->getMock('\\Doctrine\\Common\\Persistence\\ObjectRepository'); $repository->expects($this->once())->method('findOneBy')->will($this->returnValue($agency)); $om = $this->getMock('\\Doctrine\\Common\\Persistence\\ObjectManager'); $om->expects($this->once())->method('getRepository')->will($this->returnValue($repository)); $fsm = $this->getMockBuilder('\\Knp\\Bundle\\GaufretteBundle\\FilesystemMap')->setConstructorArgs(array(array()))->getMock(); $this->service = new PushService($om, $fsm); $this->author = new Author(new AgencyId(1), 1, 'Bush', 'George'); $util = new Util(); $this->resource = $util->createResourceBuilder()->body('bravo_body')->teaser('bravo_teaser')->title('bravo_title')->ctime(new \DateTime()); }
public function setUp() { /** @todo merge this into common domain fixtures */ $this->nodes = new \stdClass(); $this->resources = new \stdClass(); $this->authors = new \stdClass(); $util = new Util(); $resource_builder = $util->createResourceBuilder(); $this->resources->alpha = $resource_builder->body('alpha_body')->teaser('alpha_teaser')->title('alpha_title')->ctime(new \DateTime("-1 day"))->copyleft(new Copyleft('copyleft'))->build(); $this->resources->bravo = $resource_builder->body('bravo_body')->teaser('bravo_teaser')->title('bravo_title')->ctime(new \DateTime("+1 day"))->build(); $this->authors->alpha = new Author(new AgencyId(mt_rand()), mt_rand(), 'alpha_author'); $profile_alpha = new Profile(); $profile_bravo = new Profile(); $builder = new NodeBuilder(); $this->nodes->alpha = $builder->author($this->authors->alpha)->profile($profile_alpha)->resource($this->resources->alpha)->params(new Params(array('autorship' => new Authorship(1), 'editable' => new Editable(1))))->category(new Category('Other'))->audience(new Audience('All'))->build(); $this->nodes->bravo = $builder->author($this->authors->alpha)->profile($profile_bravo)->resource($this->resources->bravo)->params(new Params(array('autorship' => new Authorship(0), 'editable' => new Editable(1))))->category(new Category('Other'))->audience(new Audience('All'))->build(); }