public function testCreate() { $event = new ModuleHookCreateEvent(); $event->setHookId($this->hook->getId())->setModuleId($this->module->getId())->setDispatcher($this->dispatcher); $this->action->createModuleHook($event); $createdModuleHook = $event->getModuleHook(); $this->assertInstanceOf('\\Thelia\\Model\\ModuleHook', $createdModuleHook); $this->assertFalse($createdModuleHook->isNew()); $this->assertTrue($event->hasModuleHook()); $this->assertEquals($event->getHookId(), $createdModuleHook->getHookId()); $this->assertEquals($event->getModuleId(), $createdModuleHook->getModuleId()); return $createdModuleHook; }
/** * @param HookModel $hook * @depends testUpdate */ public function testDelete(HookModel $hook) { $event = new HookDeleteEvent($hook->getId()); $this->action->delete($event, null, $this->getMockEventDispatcher()); $deletedHook = $event->getHook(); $this->assertInstanceOf('Thelia\\Model\\Hook', $deletedHook); $this->assertTrue($deletedHook->isDeleted()); }
/** * Filter the query by a related \Thelia\Model\Hook object * * @param \Thelia\Model\Hook|ObjectCollection $hook The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildModuleHookQuery The current query, for fluid interface */ public function filterByHook($hook, $comparison = null) { if ($hook instanceof \Thelia\Model\Hook) { return $this->addUsingAlias(ModuleHookTableMap::HOOK_ID, $hook->getId(), $comparison); } elseif ($hook instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(ModuleHookTableMap::HOOK_ID, $hook->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByHook() only accepts arguments of type \\Thelia\\Model\\Hook or Collection'); } }
/** * Exclude object from result * * @param ChildHook $hook Object to remove from the list of results * * @return ChildHookQuery The current query, for fluid interface */ public function prune($hook = null) { if ($hook) { $this->addUsingAlias(HookTableMap::ID, $hook->getId(), Criteria::NOT_EQUAL); } return $this; }
/** * Declares an association between this object and a ChildHook object. * * @param ChildHook $v * @return \Thelia\Model\ModuleHook The current object (for fluent API support) * @throws PropelException */ public function setHook(ChildHook $v = null) { if ($v === null) { $this->setHookId(NULL); } else { $this->setHookId($v->getId()); } $this->aHook = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildHook object, it will not be re-added. if ($v !== null) { $v->addModuleHook($this); } return $this; }
/** * Returns the object ID from the object * * @param \Thelia\Model\Hook $object * * @return int */ protected function getObjectId($object) { return $object->getId(); }