text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>)->selectButton('delete')->form();
$crawler = $client->submit($form);
$this->assertSame(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
$this->assertStringContainsString('flashes.config.notice.ignore_origin_rules_deleted', $crawler->fi... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller;
use Craue\ConfigBundle\Util\Config;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\Entity\Annotation;
use Wallabag\Entity\Config as ConfigEntity;
use Walla... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Wallabag\Entity\Entry;
use Wallabag\Repository\UserRepository;
use Wallabag\Tests\Functional\WallabagTestCase;
class ExportControllerTest extends WallabagTestCase
{
private $adminEntry;
private $b... | fim | wallabag/wallabag | php |
<|fim_suffix|> $config->setFeedLimit(null);
$em->persist($config);
$entry1 = $em
->getRepository(Entry::class)
->findByUrlAndUserId('http://0.0.0.0/entry1', $user->getId())
;
$entry4 = $em
->getRepository(Entry::class)
->findByUrlAn... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Functional\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Wallabag\Entity\IgnoreOriginInstanceRule;
use Wallabag\Tests\Functional\WallabagTestCase;
class IgnoreOriginInstanceRuleControllerTest extends WallabagTestCase
{
public function testListIgnoreOriginInstanceRule(): ... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Import;
use Craue\ConfigBundle\Util\Config;
use Doctrine\ORM\EntityManagerInterface;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Wallabag\Entity\Entry;
use Wallabag\Tests\Functional\WallabagTestCase;
class ChromeCon... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Import;
use Craue\ConfigBundle\Util\Config;
use Doctrine\ORM\EntityManagerInterface;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Wallabag\Entity\Entry;
use Wallabag\Tests\Functional\WallabagTestCase;
class Delicious... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Import;
use Craue\ConfigBundle\Util\Config;
use Doctrine\ORM\EntityManagerInterface;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Wallabag\Entity\Entry;
use Wallabag\Tests\Functional\WallabagTestCase;
class Elcurator... | fim | wallabag/wallabag | php |
<|fim_suffix|>ct(['_text']));
$this->assertStringContainsString('flashes.import.notice.failed', $body[0]);
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Import;
use Craue\ConfigBundle\Util\Config;
use Doctrine\ORM\EntityManagerInterface;
use Predis\Client;
use Symfony\Component\Ht... | fim | wallabag/wallabag | php |
<|fim_suffix|>();
$crawler = $client->request('GET', '/import/');
$this->assertSame(200, $client->getResponse()->getStatusCode());
$this->assertSame(14, $crawler->filter('.card-title')->count());
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Import;
use Wallabag\T... | fim | wallabag/wallabag | php |
<|fim_suffix|> 'upload_import_file[file]' => $file,
];
$client->submit($form, $data);
$this->assertSame(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
... | fim | wallabag/wallabag | php |
<|fim_suffix|>));
$form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
$file = new UploadedFile(__DIR__ . '/../../../fixtures/Import/omnivore.json', 'omnivore.json');
$data = [
'upload_import_file[file]' => $file,
];
$client->su... | fim | wallabag/wallabag | php |
<|fim_suffix|>:class)->lpop('wallabag.import.pinboard'));
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
}
public function testImportPinboardWithFile(): void
{
$this->logInAs('admin');
$client = $this->getTestClient();
$crawler = $client->request... | fim | wallabag/wallabag | php |
<|fim_suffix|>get('location'), 'Import is ok, redirect to homepage');
$this->assertSame('flashes.import.notice.summary', $client->getContainer()->get(SessionInterface::class)->getFlashBag()->peek('notice')[0]);
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Import;
use Craue\Config... | fim | wallabag/wallabag | php |
<|fim_suffix|>se ($entries) {
foreach ($entries as $entry) {
if ($entry->getUrl() === $expectedUrl) {
return $entry;
}
}
return null;
}, $expectedEntries);
$this->assertCount(\count($expectedEntries), $matchedEntri... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Import;
use Craue\ConfigBundle\Util\Config;
use Doctrine\ORM\EntityManagerInterface;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Wallabag\Entity\Entry;
use Wallabag\Tests\Functional\WallabagTestCase;
class PocketHtm... | fim | wallabag/wallabag | php |
<|fim_suffix|>upload_import_file] > button[type=submit]')->form();
$data = [
'upload_import_file[file]' => '',
];
$client->submit($form, $data);
$this->assertSame(200, $client->getResponse()->getStatusCode());
}
public function testImportReadabilityWithRedisEnable... | fim | wallabag/wallabag | php |
<|fim_suffix|> {
$this->logInAs('admin');
$client = $this->getTestClient();
$crawler = $client->request('GET', '/import/shaarli');
$form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
$file = new UploadedFile(__DIR__ . '/../../../fixtures/I... | fim | wallabag/wallabag | php |
<|fim_suffix|>rId(
'https://www.wallabag.org/features/',
$this->getLoggedInUserId()
);
$this->assertInstanceOf(Entry::class, $content2);
$this->assertTrue($content2->isArchived());
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller\Import;
use Craue\ConfigBundle\Util\Config;
use Doctrine\ORM\EntityManagerInterface;
use Predis\Client;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Wallabag\Entity\Entry;
use Wallabag\Tests\Functional\WallabagTestCase;
class WallabagV... | fim | wallabag/wallabag | php |
<|fim_suffix|> $client = $this->getTestClient();
$client->followRedirects();
$em = $client->getContainer()->get(EntityManagerInterface::class);
$user = $em
->getRepository(User::class)
->findOneByUsername('admin');
$user->setEmailTwoFactor(true);
$em-... | fim | wallabag/wallabag | php |
<|fim_suffix|>lient->getResponse()->getStatusCode());
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Fu<|fim_middle|>nctional\Controller;
use Wallabag\Tests\Functional\WallabagTestCase;
/**
* The controller `SettingsController` does not exist.
* This test cover security against the internal settings page man... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller;
use Craue\ConfigBundle\Util\Config;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Wallabag\Entity\SiteCredential;
use Wallabag\Tests\Functional\WallabagTestCase;
class SiteCredentialControllerTest ext... | fim | wallabag/wallabag | php |
<|fim_suffix|>ient();
$client->request('GET', '/about');
$this->assertSame(200, $client->getResponse()->getStatusCode());
}
public function testHowto(): void
{
$this->logInAs('admin');
$client = $this->getTestClient();
$client->request('GET', '/howto');
$... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Wallabag\Entity\Entry;
use Wallabag\Entity\Tag;
use Wallabag\Entity\User;
use Wallabag\Tests\Functional\WallabagTestCase;
/**
* @group Tag
*/
class TagControllerTest extends WallabagTestCase
{
publi... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Functional\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Wallabag\Entity\User;
use Wallabag\Tests\Functional\WallabagTestCase;
class UserControllerTest extends WallabagTestCase
{
public function testLogin(): void
{
$client = $this->getTestClient... | fim | wallabag/wallabag | php |
<|fim_suffix|>n) {
\assert($token->getUser() instanceof User);
return $token->getUser();
}
throw new \RuntimeException('No logged in User.');
}
/**
* Return the user id of the logged in user.
* You should be sure that you called `logInAs` before.
*
... | fim | wallabag/wallabag | php |
<|fim_suffix|> if ($mustSucceed) {
$process->mustRun(static function ($type, $buffer): void {
echo $buffer;
});
return;
}
$process->run(static function ($type, $buffer): void {
echo $buffer;
});
return;
}
$proce... | fim | wallabag/wallabag | php |
<|fim_suffix|> fos_oauth_server_refresh_token_lifetime: 1209600
from_email: wallabag@example.com
rabbitmq_host: 127.0.0.1
rabbitmq_port: 5672
rabbitmq_user: guest
rabbitmq_password: guest
rabbitmq_prefetch_count: 10
redis_scheme: redis
redis_host: 127.0.0.1
redis_port: 6379
red... | fim | wallabag/wallabag | php |
<|fim_suffix|>te();
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Integration\Command;
use Symfony\Component\Console\Tester\CommandTester;
use Wallabag\Entity\Entry;
use Wallabag\Tests\Integration\WallabagKernelTestCase;
class CleanDuplicatesCommandTest extends WallabagKernelTestCase
{
public function tes... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Integration\Command;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandT<|fim_suffix|> 'username' => 'unknown',
]);
$this->assertStringContainsString('User "unknown" not found', $tester->getDisplay... | fim | wallabag/wallabag | php |
<|fim_suffix|>Wallabag\Entity\Entry e WHERE e.url = :url');
$query->setParameter('url', $url);
$query->execute();
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Integration\Command;
use Symfony\Component\Console\Tester\CommandTester;
use Wallabag\Entity\Entry;
use Wallabag\Tests\Integration\Wall... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Integration\Command\Import;
use Doctrine\ORM\NoResultException;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
use Wallabag\Tests\Integration\WallabagKernelTestCas... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Integration\Command\Import;
use M6Web\Component\RedisMock\Redi<|fim_suffix|>ew CommandTester($command);
$tester->execute([
'serviceName' => 'readability',
'--maxIterations' => 1,
]);
$this->assertStringContainsString('Worker... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Integration\Command\Import;
use Doctrine\ORM\NoResultException;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
use Wallabag\Entity\Entry;
use Wallabag\Tests\Integration\WallabagKernelTestCase;
class UrlCommand... | fim | wallabag/wallabag | php |
<|fim_suffix|>migrate',
'--no-interaction' => true,
'--env' => 'test',
]), new NullOutput());
$application->run(new ArrayInput([
'command' => 'doctrine:fixtures:load',
'--no-interaction' => true,
'--env' => 'test',
]), new NullOutput()... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Integration\Command;
use Symfony\Component\Console\Tester\CommandTester;
use Wallabag\Tests\Integration\WallabagKernelTestCase;
class ListUserCommandTest extends WallabagKernelTestCase
{
public function test<|fim_suffix|> $tester = new CommandTester($command);
... | fim | wallabag/wallabag | php |
<|fim_suffix|>sedEntry = new Entry($bob);
$this->bobNotParsedEntry->setUrl($this->url);
$this->bobNotParsedEntry->setTitle('title foo');
$this->bobNotParsedEntry->setContent('');
$this->bobNotParsedEntry->setNotParsed(true);
$this->getEntityManager()->persist($this->bobNotParsedE... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Integration\Command;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
use Wallabag\Tests\Integration\WallabagKernelTestCase;
class ShowUserCommandTest extends WallabagKernelTestCase
{
public function testRun... | fim | wallabag/wallabag | php |
<|fim_suffix|>w CommandTester($command);
$tester->execute([
'username' => 'unknown',
]);
$this->assertStringContainsString('User "unknown" not found', $tester->getDisplay());
}
public function testRunTagAllCommand(): void
{
$application = $this->createApplicatio... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Integration\Command;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
use Wallabag\Entity\Entry;
use Wallabag\Tests\Integration\WallabagKernelTestCase;
class UpdatePicturesPathCommandTest extends WallabagKernelTestCase
{
... | fim | wallabag/wallabag | php |
<|fim_suffix|> 'host' => 'api.super.com',
'expectedUsername' => '.super',
'expectedPassword' => 'bar',
],
[
'host' => '.super.com',
'expectedUsername' => '.super',
'expectedPassword' => 'bar',
],
... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Integration;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Wallabag\Entity\User;
abstract class WallabagKernelTestCase extends KernelTestCase
{
protected fun... | fim | wallabag/wallabag | php |
<|fim_suffix|>Kernel('test', true);
$kernel->boot();
return $kernel->getContainer()->get('doctrine')->getManager();
<|fim_prefix|><?php
use Symfony\Component\Dotenv\Dotenv;
/**
* Required for PHPStan.
*
* @see https://github.com/phpstan/phpstan-doctrine#configuration
*/
require __DIR__ . '/../vendor/autoload.php... | fim | wallabag/wallabag | php |
<|fim_suffix|>der(EntityManager::class)
->disableOriginalConstructor()
->getMock();
$em
->expects($this->never())
->method('flush');
$em
->expects($this->never())
->method('clear');
$body = '{ "userId": 123 }';
$... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Consumer;
use Doctrine\ORM\EntityManager;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Wallabag\Consumer\RedisEntryConsumer;
use Wallabag\Entity\Entry;
use Wallabag\Entity\User;
use Wallabag\Import\AbstractImport;
use Wall... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Entity;
use PHPUnit\Framework\TestCase;
use Wallabag\Entity\Entry;
use Wallabag\Entity\User;
class EntryTest extends TestCase
{
<|fim_suffix|>}
}
<|fim_middle|> public function testGetLanguage(): void
{
$entry = new Entry(new User());
$language... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Event\Listener;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony<|fi... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Event\Listener;
use Doctrine\ORM\EntityManager;
use FOS\UserBundle\Event\FilterUserResponseEvent;
use FOS\UserBundle\FOSUserEvents;
use PHPUnit\Framework\T<|fim_suffix|>ger::class)
->disableOriginalConstructor()
->getMock();
$this->requ... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespa<|fim_suffix|>sionStorage()));
$listener = new LocaleListener('fr');
$event = $this->getEvent($request);
$listener->onKernelRequest($event);
$this->assertSame('fr', $request->getLocale());
}
public function testLocaleFromRequestAttribute(): void
... | fim | wallabag/wallabag | php |
<|fim_suffix|> $request = Request::create('/');
$event = new InteractiveLoginEvent($request, $userToken);
$listener->onInteractiveLogin($event);
$this->assertSame('de', $session->get('_locale'));
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Event\Listener;
use PHPUnit\Framewo... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Event\Subscriber;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs... | fim | wallabag/wallabag | php |
<|fim_suffix|>alue']],
['first value, second value', ['first value', 'second value']],
['first value, , second value', ['first value', 'second value']],
];
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Form\DataTransformer;
use PHPUnit\Framework\TestCase;
use Wallabag... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Unit\Helper;
use Graby\Graby;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\Valida... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Helper;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use Wallabag\Helper\CryptoProxy;
class CryptoProxyTest extends TestCase
{
public function testCrypto(): void
{
$logHandler = new TestH... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Helper;
use Monolog\Handler\TestHandler;
use Monolog\Lo<|fim_suffix|>_get_contents(__DIR__ . '/../../fixtures/image-no-content-type.jpg')),
new MockResponse(file_get_contents(__DIR__ . '/../../fixtures/image-no-content-type.jpg')),
]);
$lo... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Helper;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Router;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\UsernameP... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Helper;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use RulerZ\RulerZ;
use Wallabag\Entity\Config;
use Wallabag\Entity\Entry;
use Wallabag\Entity\IgnoreOriginInstanceRule;
use Wallabag\Entity\IgnoreOriginUserRule;
use Wallabag\... | fim | wallabag/wallabag | php |
<|fim_suffix|>aggingRule('bla bla', ['hey']);
$otherTaggingRule = $this->getTaggingRule('rule as string', ['hey']);
$user = $this->getUser([$taggingRule, $otherTaggingRule]);
$entry = new Entry($user);
$this->rulerz
->method('satisfies')
->willReturn(true);
... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Helper;
use PHPUnit\Framework\TestCase;
use Wallabag\Entity\Entry;
use Wallabag\Entity\Tag;
use Wallabag\Entity\User;
use Wallabag\Helper\TagsAssigner;
use Wallabag\Repository\TagRepository;
class TagsAssignerTest extends TestCase
{
public function testAssignTags... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\HttpClient;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\HttpClient\ResponseInterface;
use Wallabag\HttpClient\Authenticator;
use Wallabag\SiteConfig\ArraySiteConfigBuilder;
use Wallabag\SiteConfig\LoginFor... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Unit\Import;
use Doctrine\ORM\EntityManager;
use M6Web\Component\RedisMock\RedisMockFactory;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use Predis\Client;
use Simpleue\Queue\RedisQueue;
use Symfony\Component\EventDispatcher\EventDispatcher;
use ... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Import<|fim_suffix|>Import();
$firefoxImport->setFilepath(__DIR__ . '/../../fixtures/Import/wallabag-v1.jsonx');
$res = $firefoxImport->import();
$this->assertFalse($res);
$records = $this->logHandler->getRecords();
$this->ass... | fim | wallabag/wallabag | php |
<|fim_suffix|>hain = new ImportChain();
$importChain->addImport($import, 'alias');
$this->assertCount(1, $importChain->getAll());
$this->assertSame($import, $importChain->getAll()['alias']);
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Import;
use PHPUnit\Framework\TestCase;
use ... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Import;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Wallabag\Import\ImportChain;
use Wallabag\Import\ImportCompilerPass;
class ImportCompilerPassTest extends TestCase
{
public fu<|fim_suffix|>$container = new Co... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Import;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\UnitOfWork;
use M6Web\Component\RedisMock\RedisMockFactory;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use Predis\Client;
use Simpleue\Queue\RedisQueue;
use Symfony\Comp... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Import;
use Doctrine\ORM\EntityManager;
use M6Web\Component\RedisMock\RedisMockFactory;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use Predis\Client;
use Simpleue\Queue\RedisQueue;
use Symfony\Component\EventDispatcher\EventDi... | fim | wallabag/wallabag | php |
<|fim_suffix|>ath(__DIR__ . '/../../fixtures/Import/wallabag-v1.jsonx');
$res = $pocketHtmlImport->import();
$this->assertFalse($res);
$records = $this->logHandler->getRecords();
$this->assertStringContainsString('Pocket HTML Import: unable to read file', $records[0]['message']);
... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Import;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\UnitOfWork;
use M6Web\Component\RedisMock\RedisMockFactory;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use Predis\Client;
use Simpleue\Queue\RedisQueue;
use Symfony\Comp... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Import;
use Doctrine\ORM\EntityManager;
use M6Web\Component\RedisMock\RedisMockFactory;
use Monolog\Handler\TestHandler;
use Monolo<|fim_suffix|>ss ReadabilityImportTest extends TestCase
{
protected $user;
protected $em;
protected $logHandler;
protecte... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Import;
use Doctrine\ORM\EntityManager;
use M6Web\Component\RedisMock\RedisMockFactory;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use Predis\Client;
use Simpleue\Queue\RedisQueue;
use Symfony\Component\EventDispatcher\EventDi... | fim | wallabag/wallabag | php |
<|fim_suffix|>ockBuilder(ContentProxy::class)
->disableOriginalConstructor()
->getMock();
$this->tagsAssigner = $this->getMockBuilder(TagsAssigner::class)
->disableOriginalConstructor()
->getMock();
$dispatcher = $this->getMockBuilder(EventDispatcher::cl... | fim | wallabag/wallabag | php |
<|fim_suffix|>');
$entryRepo = $this->getMockBuilder(EntryRepository::class)
->disableOriginalConstructor()
->getMock();
$entryRepo->expects($this->exactly(2))
->method('findByUrlAndUserId')
->will($this->onConsecutiveCalls(false, false));
$this... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Unit\Mailer;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Address;
use Twig\Environment;
use Twig\Loader\ArrayLoader;
use Wallabag\Entity\User;
use Wallabag\Mailer\AuthCodeMailer;
class AuthCodeMailerTest extends TestCase
{
... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\ParamConverter;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\ObjectManager;
use PHPUnit\Framework\TestCase;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component... | fim | wallabag/wallabag | php |
<|fim_suffix|>->token = $this->createMock(TokenInterface::class);
$this->token->method('getUser')->willReturn(new User());
$this->adminVoter = new AdminVoter($this->security);
}
public function testVoteReturnsAbstainForInvalidAttribute(): void
{
$this->assertSame(VoterInterface::AC... | fim | wallabag/wallabag | php |
<|fim_suffix|>nsGrantedForAnnotationUserDelete(): void
{
$user = new User();
$this->token->method('getUser')->willReturn($user);
$this->assertSame(VoterInterface::ACCESS_GRANTED, $this->annotationVoter->vote($this->token, new Annotation($user), [AnnotationVoter::DELETE]));
}
}
<|fim_pr... | fim | wallabag/wallabag | php |
<|fim_suffix|> EntryVoter();
}
public function testVoteReturnsAbstainForInvalidSubject(): void
{
$this->assertSame(VoterInterface::ACCESS_ABSTAIN, $this->entryVoter->vote($this->token, new \stdClass(), [EntryVoter::EDIT]));
}
public function testVoteReturnsAbstainForInvalidAttribute(): voi... | fim | wallabag/wallabag | php |
<|fim_suffix|>>token, new IgnoreOriginInstanceRule(), [IgnoreOriginInstanceRuleVoter::EDIT]));
}
public function testVoteReturnsGrantedForSuperAdminEdit(): void
{
$this->security->method('isGranted')->with('ROLE_SUPER_ADMIN')->willReturn(true);
$this->assertSame(VoterInterface::ACCESS_GRAN... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Unit\Security\Voter;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
use Wallabag\Entity\Config;
use Wallabag\Entity\IgnoreOriginUserRule;
use Wallabag\Entity... | fim | wallabag/wallabag | php |
<?php
namespace Wallabag\Tests\Unit\Security\Voter;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
use Symfony\Component\Security\Core\Security;
use Wallabag\Entity\User;
use Wallabag\Secu... | fim | wallabag/wallabag | php |
<|fim_suffix|>lass);
$this->token->method('getUser')->willReturn($this->user);
$this->siteCredentialVoter = new SiteCredentialVoter();
}
public function testVoteReturnsAbstainForInvalidSubject(): void
{
$this->assertSame(VoterInterface::ACCESS_ABSTAIN, $this->siteCredentialVoter->v... | fim | wallabag/wallabag | php |
<|fim_suffix|>agVoter->vote($this->token, new Tag(), [TagVoter::DELETE]));
}
public function testVoteReturnsGrantedForAuthorizedUserDelete(): void
{
$this->token->method('getUser')->willReturn(new User());
$this->security->method('isGranted')->with('ROLE_USER')->willReturn(true);
... | fim | wallabag/wallabag | php |
<|fim_suffix|> $this->assertSame(VoterInterface::ACCESS_GRANTED, $this->taggingRuleVoter->vote($this->token, $taggingRule, [TaggingRuleVoter::DELETE]));
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Security\Voter;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Security\Core\Authentication\Toke... | fim | wallabag/wallabag | php |
<|fim_suffix|>ic function testVoteReturnsDeniedForSelfDelete(): void
{
$user = new User();
$this->token->method('getUser')->willReturn($user);
$this->assertSame(VoterInterface::ACCESS_DENIED, $this->userVoter->vote($this->token, $user, [UserVoter::DELETE]));
}
public function testV... | fim | wallabag/wallabag | php |
<|fim_suffix|>uildForHost('www.example.com');
$this->assertInstanceOf(SiteConfig::class, $res);
}
public function testItReturnsFalseOnAHostThatDoesNotExist(): void
{
$builder = new ArraySiteConfigBuilder(['anotherexample.com' => []]);
$res = $builder->buildForHost('example.com');
... | fim | wallabag/wallabag | php |
<|fim_suffix|>logger = new Logger('foo');
$handler = new TestHandler();
$logger->pushHandler($handler);
$siteCrentialRepo = $this->getMockBuilder(SiteCredentialRepository::class)
->disableOriginalConstructor()
->getMock();
$tokenStorage = new TokenStorage();
... | fim | wallabag/wallabag | php |
<|fim_suffix|>e' => 'johndoe',
'password' => 'unkn0wn',
'httpHeaders' => [
'user-agent' => 'Wallabag (Guzzle/5)',
],
]);
$browserResponse = new MockResponse('<html></html>', ['http_code' => 200, 'response_headers' => ['content-type' => 'text/html']]);... | fim | wallabag/wallabag | php |
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\SiteConfig;
use PHPUnit\Framework\TestCase;
use Wallabag\SiteConfig\SiteConfig;
class SiteConfigTest extends TestCase
{
public function testInitSiteConfig(): void
{
$config = new SiteConfig([]);
$this->assertInstanceOf(SiteConfig::class, $con... | fim | wallabag/wallabag | php |
<|fim_suffix|>time
];
}
return $examples;
}
}
<|fim_prefix|><?php
namespace Wallabag\Tests\Unit\Tools;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Finder\Finder;
use Wallabag\Tools\Utils;
class UtilsTest extends TestCase
{
/**
* @dataProvider examples
*/
p... | fim | wallabag/wallabag | php |
<|fim_suffix|>sion->removeSchemeAndWww('http://www.lemonde.fr'));
$this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('http://lemonde.fr'));
$this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('https://www.lemonde.fr'));
$this->assertSame('lemonde.fr', $extension->removeSch... | fim | wallabag/wallabag | php |
<|fim_suffix|>b/index.php instead.',
E_USER_DEPRECATED
);
}
$_SERVER['APP_ENV'] ??= 'prod';
$_SERVER['APP_DEBUG'] ??= '0';
return require __DIR__.'/index.php';
<|fim_prefix|><?php
if (!defined('WALLABAG_APP_PHP_DEPRECATED')) {
define('WALLABAG_APP_PHP_DEPRECATED', true);
trigger_error(
'w... | fim | wallabag/wallabag | php |
<?php
// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(@$_SERVER['REMOTE_ADDR... | fim | wallabag/wallabag | php |
<|fim_suffix|>($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
<|fim_prefix|><?php
require_once __DIR__.'/../vendor/autoload_runtime.php';
return function (array $context): AppKernel {
<|fim_middle|> return new AppKernel<|endoftext|> | fim | wallabag/wallabag | php |
<|fim_prefix|>fos.Router.setData({
base_url: '',
routes: {
import_chrome: {
tokens: [['text', '/import/chrome']], defaults: [], requirements: [], hosttokens: [],
},
import_firefox: {
tokens: [['text', '/import/firefox']], defaults: [], requirements: [], hosttokens: [],
},
import: {
... | fim | wallabag/wallabag | javascript |
<|fim_suffix|>m: './node_modules/mathjax/sre',
to: 'sre/[path][name].[ext]',
})
.addAliases({
module$: path.resolve(__dirname, 'assets/vendor/node_module_browser_stub.js'),
})
.addPlugin(codecovWebpackPlugin({
enableBundleAnalysis: typeof process.env.CODECOV_TOKEN !== 'undefined',
bundleName: 'w... | fim | wallabag/wallabag | javascript |
#!/usr/bin/env python3
# Author: Volodymyr Shymanskyy
import argparse
import subprocess
import multiprocessing
from pathlib import Path
import time
import os
import contextlib
musl_targets = [
{ "name": "linux-x86_64" , "arch": "x86_64-linux-musl" },
{ "name": "linux-i686" , "arch": "i686-l... | fim | wasm3/wasm3 | python |
<|fim_prefix|>#!/usr/bin/env python3
# Author: Volodymyr Shymanskyy
import os
import re, fnmatch
import pathlib
class<|fim_suffix|> k, v in kwargs.items():
self[k] = v
__getattr__ = dict.get
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
class Blacklist():
def __init_... | fim | wasm3/wasm3 | python |
<|fim_suffix|>ain(JNIEnv* env, jobject instance)
{
setvbuf(stdout, 0, _IOLBF, 0); // stdout: line-buffered
setvbuf(stderr, 0, _IONBF, 0); // stderr: unbuffered
// create the pipe and redirect stdout and stderr
pipe(pfd);
dup2(pfd[1], 1);
dup2(pfd[1], 2);
jclass clz = (*env)->GetObjectClass... | fim | wasm3/wasm3 | c |
<|fim_prefix|>//
// Wasm3 - high performance WebAssembly interpreter written in C.
//
// Copyright © 2019 Steven Massey, Volodymyr Shymanskyy.
// All rights reserved.
//
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "m3/wasm<|fim_suffix|>= m3_ParseModule (env, &module, wasm, fsize);
if (res... | fim | wasm3/wasm3 | c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.