Beispiel #1
0
 public function testLessThan()
 {
     $newCN = \Dewey::parseCallNumber($this->callNumber);
     $this->assertTrue($newCN->lessThan($this->cn), 'A DDS call number w/o a cutter will calculate less than the same with');
     $this->assertTrue($this->cn->lessThan("515"), 'lessThan works with a single major number');
     $this->assertFalse($this->cn->lessThan($newCN), 'instance CallNumber shouldn\'t be less than the test one');
 }
Beispiel #2
0
 public function testParser()
 {
     $cn = Dewey::parseCallNumber($this->callNumber);
     $this->assertTrue($cn->hasCutter());
     $this->assertFalse($cn->hasPrestamp());
     $this->assertEquals("", $cn->getPrestamp());
     $this->assertEquals("514.123", $cn->getCallNumber());
     $this->assertEquals("A997x", $cn->getCutter());
     unset($cn);
     $cn = Dewey::parseCallNumber("DVD 791.4372");
     $this->assertTrue($cn->hasPrestamp());
     $this->assertFalse($cn->hasCutter());
     $this->assertEquals("DVD", $cn->getPrestamp());
     $this->assertEquals("791.4372", $cn->getCallNumber());
     $this->assertEquals("", $cn->getCutter());
 }
Beispiel #3
0
 /**
  *  does this call number fall between the ranges specified? can use
  *  DDS call number string or a Dewey\CallNumber object
  *
  *  @param  mixed       either a range string (using `x` to denote the area of range, or a tuple of min/max)
  *  @param  boolean     whether to include $max in equation  (true for LTEQ, false for LT)
  *  @return boolean 
  */
 public function inRange($range, $lessThanEqualTo = true)
 {
     if (is_string($range)) {
         $range = \Dewey::calculateRange($range);
     }
     list($min, $max) = $range;
     return $this->greaterThanEqualTo($min) && (!!$lessThanEqualTo === true ? $this->lessThanEqualTo($max) : $this->lessThan($max));
 }