Example #1
0
 /**
  * @test
  */
 public function resolvesConvertsDomainObjectsToIdentityArrays()
 {
     $object1 = new \stdClass();
     $object2 = new \stdClass();
     $originalArray = array('foo' => 'bar', 'someObject' => $object1, 'baz' => array('someOtherObject' => $object2));
     $convertedArray = array('foo' => 'bar', 'someObject' => array('__identity' => 'x'), 'baz' => array('someOtherObject' => array('__identity' => 'y')));
     $mockPersistenceManager = $this->getMock('TYPO3\\FLOW3\\Persistence\\PersistenceManagerInterface');
     $mockPersistenceManager->expects($this->once())->method('convertObjectsToIdentityArrays')->with($originalArray)->will($this->returnValue($convertedArray));
     $this->route->injectPersistenceManager($mockPersistenceManager);
     $this->route->setUriPattern('foo');
     $this->route->setAppendExceedingArguments(TRUE);
     $this->route->_set('isParsed', TRUE);
     $this->route->resolves($originalArray);
     $actualResult = $this->route->getMatchingUri();
     $expectedResult = '?foo=bar&someObject%5B__identity%5D=x&baz%5BsomeOtherObject%5D%5B__identity%5D=y';
     $this->assertEquals($expectedResult, $actualResult);
 }