Skip to content

Commit

Permalink
Add argument unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zstein-holts committed Mar 10, 2020
1 parent bf5c9a9 commit c92a861
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/ArgumentsSaneTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php


use PHPUnit\Framework\TestCase;

class ArgumentsSaneTest extends TestCase {

public final function testIllegalArgumentExtraParam() {
$this->expectException(InvalidArgumentException::class);
$personator = new \Holtsdev\Personator\Personator('DOESNTMATTER');
$result = $personator->doRequest(array(\Holtsdev\Personator\Personator::VERIFY,
\Holtsdev\Personator\Personator::APPEND, 'Meow'), array()); // Second parameter doesn't actually matter

}

public final function testIllegalArgumentEmptyArrays() {
$this->expectException(InvalidArgumentException::class);
$personator = new \Holtsdev\Personator\Personator('DOESNTMATTER');
$result = $personator->doRequest(array(), array());
}

public final function testIllegalArgumentNull() {
$this->expectException(TypeError::class);
$personator = new \Holtsdev\Personator\Personator('DOESNTMATTER');
$result = $personator->doRequest(null, array());
}

public final function testIllegalArgumentJustWrong() {
$this->expectException(InvalidArgumentException::class);
$personator = new \Holtsdev\Personator\Personator('DOESNTMATTER');
$result = $personator->doRequest(array('meow'), array());
}

public final function testHasGoodArgumentRequestType() {
$personator = new \Holtsdev\Personator\Personator('DOESNTMATTER');
$result = $personator->doRequest(array(\Holtsdev\Personator\Personator::VERIFY, \Holtsdev\Personator\Personator::APPEND), array());
$this->assertEquals(1,1); // Dummy assertion, if no exception was thrown before this we know we're good.
}
}

0 comments on commit c92a861

Please sign in to comment.