Skip to content

Commit

Permalink
PhpInterpreter: added hasExtension()
Browse files Browse the repository at this point in the history
  • Loading branch information
milo authored and dg committed Apr 18, 2016
1 parent 653d39f commit ded7935
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Runner/PhpInterpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,14 @@ public function getShortInfo()
. ($this->info->hhvmVersion ? "; HHVM {$this->info->hhvmVersion}" : '');
}


/**
* @param string
* @return bool
*/
public function hasExtension($name)
{
return in_array(strtolower($name), array_map('strtolower', $this->info->extensions), TRUE);
}

}
10 changes: 10 additions & 0 deletions tests/Runner/PhpInterpreter.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

use Tester\Assert;

require __DIR__ . '/../bootstrap.php';

$interpreter = createInterpreter();

Assert::true($interpreter->hasExtension('DaTe'));
Assert::false($interpreter->hasExtension('foo-bar'));

0 comments on commit ded7935

Please sign in to comment.