public function test_it_should_represent_itself_in_json() { // Given $stateWorkflow = $this->createValidStateWorkflow(); $introspectedWorkflow = new IntrospectedWorkflow($stateWorkflow); $expected = '{"nodes":[{"data":{"id":"a","name":"A","weight":50,"faveColor":"#999999","faveShape":"triangle"}},{"data":{"id":"b","name":"B","weight":50,"faveColor":"#FFFFFF","faveShape":"rectangle"}},{"data":{"id":"c","name":"C","weight":50,"faveColor":"#FFFFFF","faveShape":"ellipse"}}],"edges":[{"data":{"source":"a","target":"b","faveColor":"#999999","strength":20}},{"data":{"source":"b","target":"c","faveColor":"#FFFFFF","strength":20}}]}'; // When $representation = new SUT($introspectedWorkflow); $actual = $representation->serialize(); // Then $this->assertEquals($expected, $actual, 'State Workflow are not well represented in JSON Cytoscape anymore.'); }
/** * @param CytoscapeWorkflowRepresentation $workflowRepresentation * @param $htmlTemplate * @return mixed */ private function fillTemplateWithWorkflowName(CytoscapeWorkflowRepresentation $workflowRepresentation, $htmlTemplate) { return str_replace(self::TEMPLATE_VARIABLE_WORKFLOW_NAME, $workflowRepresentation->getWorkflowName(), $htmlTemplate); }