Skip to content

Commit

Permalink
Fix dataproviders in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danmichaelo committed Feb 27, 2024
1 parent 4242174 commit d00c4d5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions tests/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testExceptionOnInvalidEncoding()
*
* @return array
*/
public function mrcFiles()
public static function mrcFiles()
{
return [
['sandburg.mrc', 1], // Single binary MARC file
Expand All @@ -48,7 +48,7 @@ public function mrcFiles()
*
* @return array
*/
public function xmlFiles()
public static function xmlFiles()
{
return [
['oaipmh-bibsys.xml', 89], // Records encapsulated in OAI-PMH response
Expand Down Expand Up @@ -86,7 +86,7 @@ public function testCollectionFromFile($filename, $expected)
*/
public function testInitializeFromSimpleXmlElement($filename, $expected)
{
$el = simplexml_load_file($this->pathTo($filename));
$el = simplexml_load_file(self::pathTo($filename));

$collection = Collection::fromSimpleXMLElement($el);

Expand Down
4 changes: 2 additions & 2 deletions tests/ExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public function testExample($filename)
}
}

public function exampleDataProvider()
public static function exampleDataProvider()
{
foreach (glob($this->pathTo('examples/*.xml')) as $filename) {
foreach (glob(self::pathTo('examples/*.xml')) as $filename) {
yield [$filename];
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/RecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ public function testExampleWithCustomPrefix()

public function testBinaryMarc()
{
$record = Record::fromFile($this->pathTo('binary-marc.mrc'));
$record = Record::fromFile(self::pathTo('binary-marc.mrc'));
$this->assertInstanceOf(Record::class, $record);
}

public function testThatFieldObjectsAreReturned()
{
$record = Record::fromFile($this->pathTo('binary-marc.mrc'));
$record = Record::fromFile(self::pathTo('binary-marc.mrc'));
$this->assertInstanceOf(Field::class, $record->getField('020'));
$this->assertInstanceOf(Field::class, $record->getFields('020')[0]);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

class TestCase extends \PHPUnit\Framework\TestCase
{
protected function pathTo($filename)
protected static function pathTo($filename)
{
return __DIR__ . '/data/' . $filename;
}

protected function getTestCollection($filename)
{
return Collection::fromFile($this->pathTo($filename));
return Collection::fromFile(self::pathTo($filename));
}

protected function getNthrecord($filename, $n)
Expand Down

0 comments on commit d00c4d5

Please sign in to comment.