예제 #1
0
 public function testSaveExtraFilledId()
 {
     $uid = 123;
     $this->userMock->expects($this->atLeastOnce())->method('getId')->willReturn($uid);
     $this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->dbAdapterMock);
     $this->dbAdapterMock->expects($this->once())->method('update');
     $this->assertInstanceOf('Magento\\User\\Model\\ResourceModel\\User', $this->model->saveExtra($this->userMock, [1, 2, 3]));
 }
예제 #2
0
    public function testBeforeSave()
    {
        $this->userMock->expects($this->once())->method('isObjectNew')->willReturn(true);

        $this->assertInstanceOf(
            '\Magento\User\Model\ResourceModel\User',
            $this->invokeMethod($this->model, '_beforeSave', [$this->userMock])
        );
    }
 /**
  * We want to test that the file is unlinked
  */
 public function testCreateResourceFromPath()
 {
     $resourceName = 'js_75a9295_bootstrap-modal_3.js';
     $resourceContainerName = 'liuggio_assetic';
     $path = 'rscf://' . $resourceContainerName . '/' . $resourceName;
     $object = $this->getMockBuilder('\\OpenCloud\\ObjectStore\\Resource\\Container')->disableOriginalConstructor()->setMethods(array('setName'))->getMock();
     $object->expects($this->once())->method('setName')->with($this->equalTo($resourceName));
     $container = $this->getMockBuilder('\\OpenCloud\\ObjectStore\\Resource\\Container')->disableOriginalConstructor()->getMock();
     $container->expects($this->once())->method('dataObject')->will($this->returnValue($object));
     $this->objectStore->expects($this->once())->method('getContainer')->with($this->equalTo('liuggio_assetic'))->will($this->returnValue($container));
     $resource = new RackspaceCloudFilesResource();
     $resource->setResourceName($resourceName);
     $resource->setContainerName($resourceContainerName);
     $resource->setObject($object);
     $resource->setContainer($container);
     $resource->setCurrentPath($path);
     $ret = $this->RSCFService->createResourceFromPath($path);
     $this->assertEquals($ret, $resource);
 }