示例#1
0
 /** @test */
 public function itShouldBeAbleToAddObjectResources()
 {
     $collection = new Collection();
     $collection->addObjectResource($this);
     $res = $collection->all();
     $this->assertArrayHasKey(0, $res);
     $this->assertInstanceOf('Lucid\\Resource\\ObjectResource', $res[0]);
 }
示例#2
0
 private function mockLocator()
 {
     $locator = $this->getMockbuilder('Lucid\\Resource\\LocatorInterface')->disableOriginalConstructor()->getMock();
     $locator->method('locate')->willReturnCallback(function ($file) {
         $collection = new Collection();
         if (file_exists($file = $this->fixure($file))) {
             $collection->addFileResource($file);
         }
         return $collection;
     });
     return $locator;
 }