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']); }
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); }
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) { } }
public function testEncryptorNoWrappers() { $encryptor = new ObjectEncryptor(); try { $encryptor->encrypt("test"); $this->fail("Misconfigured object encryptor must raise exception."); } catch (ApplicationException $e) { } }
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']); }