public function SimpleFbConnectUserManagerTest::testDownloadProfilePicWhenDirectoryNotWriteable in Simple FB Connect 8.2
Same name and namespace in other branches
- 8.3 tests/src/Unit/SimpleFbConnectUserManagerTest.php \Drupal\Tests\simple_fb_connect\Unit\SimpleFbConnectUserManagerTest::testDownloadProfilePicWhenDirectoryNotWriteable()
Tests downloadProfilePic when target directory is not writeable.
@covers ::downloadProfilePic @covers ::getPictureDirectory
File
- tests/
src/ Unit/ SimpleFbConnectUserManagerTest.php, line 331 - Contains Drupal\Tests\simple_fb_connect\Unit\SimpleFbConnectUserManagerTest.
Class
- SimpleFbConnectUserManagerTest
- @coversDefaultClass Drupal\simple_fb_connect\SimpleFbConnectUserManager @group simple_fb_connect
Namespace
Drupal\Tests\simple_fb_connect\UnitCode
public function testDownloadProfilePicWhenDirectoryNotWriteable() {
$picture_directory = 'not/writeable/directory';
$field_definition = $this
->getMock('Drupal\\Core\\Field\\FieldDefinitionInterface');
$field_definition
->expects($this
->once())
->method('getSetting')
->with('file_directory')
->willReturn($picture_directory);
$this->entityFieldManager
->expects($this
->any())
->method('getFieldDefinitions')
->with('user', 'user')
->willReturn(array(
'user_picture' => $field_definition,
));
$this->token
->expects($this
->once())
->method('replace')
->willReturn($picture_directory);
$this->transliteration
->expects($this
->once())
->method('transliterate')
->willReturn($picture_directory);
$logger_channel = $this
->getMockBuilder('Drupal\\Core\\Logger\\LoggerChannel')
->disableOriginalConstructor()
->getMock();
$this->loggerFactory
->expects($this
->any())
->method('get')
->with('simple_fb_connect')
->willReturn($logger_channel);
$this
->assertFalse($this->userManager
->subDownloadProfilePic('http://www.example.com/picture.jpg', '1234'));
}