public function testInvalidIds() { $ids = array(1, '1', '54315308c9a61dff0cd2d25', '!4315308c9a61dff0cd2d259'); foreach ($ids as $id) { $this->assertFalse($this->entityid->isValid($id)); } }
/** * @param \ChartBlocks\Entity\EntityInterface|string $parameter * @throws \InvalidArgumentException * @return string $setId */ protected function extractIdFromParameter($idOrEntity) { if (is_string($idOrEntity) && EntityId::isValid($idOrEntity)) { return $idOrEntity; } if ($idOrEntity instanceof EntityInterface) { return $idOrEntity->getId(); } throw new \InvalidArgumentException('Entity or Entity ID required'); }