コード例 #1
0
ファイル: JobProcessorTest.php プロジェクト: keboola/syrup
 public function testProcessor()
 {
     $processor = new JobProcessor();
     $configEncryptor = new ObjectEncryptor();
     $configEncryptor->pushWrapper(new BaseWrapper(uniqid('fooBar')));
     $processor->setJob(new Job($configEncryptor, ['id' => uniqid(), 'runId' => uniqid(), 'lockName' => uniqid()], null, null, null));
     $record = $processor($this->getRecord());
     $this->assertArrayHasKey('job', $record);
     $this->assertArrayHasKey('id', $record['job']);
 }
コード例 #2
0
 public function setUp()
 {
     $this->httpClient = $this->createClient();
     $container = $this->httpClient->getContainer();
     $this->restApi = $container->get('wr_google_drive.rest_api');
     $this->encryptor = $container->get('syrup.object_encryptor');
     $this->testCsvPath = realpath(__DIR__ . '/../data/test.csv');
     $this->test2CsvPath = realpath(__DIR__ . '/../data/test2.csv');
     $this->test3CsvPath = realpath(__DIR__ . '/../data/test3.csv');
     $this->expectedFeedPath = realpath(__DIR__ . '/../data/test-feed.xml');
     $accessToken = $this->encryptor->decrypt(ACCESS_TOKEN);
     $refreshToken = $this->encryptor->decrypt(REFRESH_TOKEN);
     $this->initApi($accessToken, $refreshToken);
 }
コード例 #3
0
 public function testEncryptorNoWrappers()
 {
     $client = static::createClient();
     $encryptor = new ObjectEncryptor($client->getContainer());
     try {
         $encryptor->encrypt("test");
         $this->fail("Misconfigured object encryptor must raise exception.");
     } catch (ApplicationException $e) {
     }
 }
コード例 #4
0
ファイル: ObjectEncryptorTest.php プロジェクト: keboola/syrup
 public function testEncryptorNoWrappers()
 {
     $encryptor = new ObjectEncryptor();
     try {
         $encryptor->encrypt("test");
         $this->fail("Misconfigured object encryptor must raise exception.");
     } catch (ApplicationException $e) {
     }
 }
コード例 #5
0
ファイル: SyslogProcessorTest.php プロジェクト: keboola/syrup
 public function testJobLong()
 {
     $processor = new JobProcessor();
     $configEncryptor = new ObjectEncryptor();
     $configEncryptor->pushWrapper(new BaseWrapper(uniqid('foobar')));
     $jobId = intval(uniqid());
     $processor->setJob(new Job($configEncryptor, ['id' => $jobId, 'runId' => uniqid(), 'lockName' => uniqid()], null, null, null));
     $record = $this->getRecord(Logger::WARNING, str_repeat('batman', 1000));
     $record = $processor($record);
     $processor = $this->getSysLogProcessor();
     $newRecord = $processor($record);
     $this->assertEquals(9, count($newRecord));
     $this->assertArrayHasKey('message', $newRecord);
     $this->assertArrayHasKey('component', $newRecord);
     $this->assertArrayHasKey('runId', $newRecord);
     $this->assertArrayHasKey('pid', $newRecord);
     $this->assertArrayHasKey('priority', $newRecord);
     $this->assertArrayHasKey('level', $newRecord);
     $this->assertArrayHasKey('component', $newRecord);
     $this->assertArrayHasKey('attachment', $newRecord);
     $this->assertArrayHasKey('token', $newRecord);
     $this->assertEquals(1, count($newRecord['job']));
     $this->assertArrayHasKey('id', $newRecord['job']);
     $this->assertEquals($jobId, $newRecord['job']['id']);
 }