Skip to content

Commit

Permalink
Continue to search Java execution problems on Travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgaillard committed Aug 9, 2016
1 parent bf02f51 commit 9054dc7
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
26 changes: 26 additions & 0 deletions src/main/php/Gomoob/BinaryDriver/DebugListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/**
* Copyright 2016 SARL GOMOOB. All rights reserved.
*/
namespace Gomoob\BinaryDriver;

use Evenement\EventEmitter;
use Alchemy\BinaryDriver\Listeners\ListenerInterface;
use Symfony\Component\Process\Process;

class DebugListener extends EventEmitter implements ListenerInterface
{
public function handle($type, $data)
{
foreach (explode(PHP_EOL, $data) as $line) {
$this->emit($type === Process::ERR ? 'error' : 'out', array($line));
}
}

public function forwardedEvents()
{
// forward 'error' events to the BinaryInterface
return array('error');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Gomoob\MetadataExtractor\Metadata\Exif\ExifInteropDirectory;
use Gomoob\MetadataExtractor\Metadata\Exif\Makernotes\CanonMakernoteDirectory;
use Gomoob\MetadataExtractor\Metadata\Exif\GpsDirectory;
use Gomoob\MetadataExtractor\Lang\Rational;

/**
* Reads metadata from any supported file format.
Expand Down Expand Up @@ -174,8 +175,16 @@ private static function addTagToDirectory(Directory $directory, $tagLine)
case 'Maximum Sample Value':
break;
case 'X Resolution':
$directory->setRational(
ExifIFD0Directory::TAG_X_RESOLUTION,
new Rational(static::parseDotsString($nameAndDescription[1]), 1)
);
break;
case 'Y Resolution':
$directory->setRational(
ExifIFD0Directory::TAG_X_RESOLUTION,
new Rational(static::parseDotsString($nameAndDescription[1]), 1)
);
break;
case 'Planar Configuration':
break;
Expand Down
10 changes: 6 additions & 4 deletions src/test/php/Gomoob/BinaryDriver/JavaDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PHPUnit\Framework\TestCase;
use Monolog\Handler\StreamHandler;
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
use Alchemy\BinaryDriver\Listeners\DebugListener;

/**
* Test case used to test the {@link JavaDriver} class.
Expand All @@ -26,18 +27,19 @@ public function testCreate()
$logger = new Logger('JavaDriver');
$logger->pushHandler(new StreamHandler('php://output'));

$listener = new DebugListener();

// Calls the method to be tested
$javaDriver = JavaDriver::create($logger);
$javaDriver->listen($listener);

$javaDriver->on('error', function ($line) {
echo '[ERROR] ' . $line . PHP_EOL;
$javaDriver->on('debug', function ($line) {
echo $line;
});

// TODO: To be deleted
$output = $javaDriver->command(['-version']);
var_dump($output);



// Makes a simple call to ensure it works
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function testReadMetadata()
// Checks 'Exif IFD0' directory
$directory = $metadata->getDirectories()[0];

// $tag = $directory->getTagName(ExifIFD0Directory::TAG_X_RESOLUTION);
// var_dump($tag);
$tag = $directory->getTagName(ExifIFD0Directory::TAG_X_RESOLUTION);
var_dump($tag);

// TODO: Continue testing
}
Expand Down

0 comments on commit 9054dc7

Please sign in to comment.