public function testGetContactInformationColumns() { $entity = 'Entity'; $this->queryDesigner->expects($this->once())->method('getDefinition')->will($this->returnValue(json_encode(array('columns' => array(array('name' => $this->fields['one']), array('name' => $this->fields['two']), array('name' => $this->fields['three']), array('name' => $this->fields['four'])))))); $this->queryDesigner->expects($this->once())->method('getEntity')->will($this->returnValue($entity)); $this->assertContactInformationConfig($entity); $this->assertEquals(array('email' => array(array('name' => $this->fields['one'])), 'phone' => array(array('name' => $this->fields['two']))), $this->helper->getQueryContactInformationColumns($this->queryDesigner)); }
/** * Assert that value has contact information column in it's definition. * * @param AbstractQueryDesigner $value * @param string $type * @return bool */ protected function assertContactInformationFields(AbstractQueryDesigner $value, $type) { $contactInformationFields = $this->contactInformationFieldHelper->getQueryContactInformationColumns($value); if ($type) { return array_key_exists($type, $contactInformationFields) && (bool) count($contactInformationFields[$type]); } return (bool) count($contactInformationFields); }
/** * Assert that value has contact information column in it's definition. * * @param AbstractQueryDesigner $value * @return bool */ protected function assertContactInformationFields(AbstractQueryDesigner $value) { return count($this->contactInformationFieldHelper->getQueryContactInformationColumns($value)) > 0; }