/** * @covers ::slugify */ public function testSlugifyShouldSlugifyString() { $string = 'Test string'; $slug = 'test-string'; $mockConfigService = $this->getMock('Craft\\ConfigService'); $mockConfigService->expects($this->any())->method('get')->willReturnCallback(function ($option) { if ($option == 'allowUppercaseInSlug') { return false; } elseif ($option == 'slugWordSeparator') { return '-'; } }); $this->setComponent(craft(), 'config', $mockConfigService); $service = new ImportService(); $result = $service->slugify($string); $this->assertSame($slug, $result); }