Extends
lithium\test\Unit
Tests reading specific line numbers of a file.
Returns
voidSource
public function testLineIntrospection() {
$result = Inspector::lines(__FILE__, array(__LINE__ - 1));
$expected = array(__LINE__ - 2 => "\tpublic function testLineIntrospection() {");
$this->assertEqual($expected, $result);
$result = Inspector::lines(__CLASS__, array(15));
$expected = array(15 => 'class InspectorTest extends \lithium\test\Unit {');
$this->assertEqual($expected, $result);
$lines = 'This is the first line.' . PHP_EOL . 'And this the second.';
$result = Inspector::lines($lines, array(2));
$expected = array(2 => 'And this the second.');
$this->assertEqual($expected, $result);
$this->expectException('/Missing argument 2/');
$this->assertNull(Inspector::lines('\lithium\core\Foo'));
$this->assertNull(Inspector::lines(__CLASS__, array()));
}