/**
  * @test
  * @author Christopher Hlubek <*****@*****.**>
  */
 public function synchronizeWithNoDesignDocumentCollectsDeclarationsAndCreatesDesignDocument()
 {
     $mockReflectionService = $this->getMock('TYPO3\\Flow\\Reflection\\ReflectionService');
     $design = new Fixtures\Design\CompanyDesign();
     $design->setClient($this->client);
     $design->injectReflectionService($mockReflectionService);
     $mockReflectionService->expects($this->any())->method('isMethodStatic')->will($this->returnCallback(function ($className, $methodName) {
         if ($methodName === 'totalPurchasesDeclaration') {
             return TRUE;
         }
         return FALSE;
     }));
     $this->client->expects($this->any())->method('getDocument')->with('_design/company')->will($this->throwException(new \TYPO3\CouchDB\Client\NotFoundException('{"error":"not_found","reason":"missing"}')));
     $this->client->expects($this->once())->method('createDocument')->with(array('_id' => '_design/company', 'language' => 'javascript', 'views' => array('totalPurchases' => array('map' => 'function(doc) { if (doc.Type == "purchase") { emit(doc.Customer, doc.Amount); } }', 'reduce' => 'function(keys, values) { return sum(values) }'))));
     $design->synchronize();
 }