/** * @param string $name * @param int $start * @param int $end * @param int $seconds * * @return RuleInterface|null */ public function buildRule($name, $start, $end, $seconds) { if (!$this->collection->has($name)) { return null; } return $this->collection->get($name)->setEnd($end)->setStart($start)->setSeconds($seconds); }
public function testGetSet() { $this->assertFalse($this->collection->has('foo')); $this->assertNull($this->collection->get('foo')); /* @var $rule \PHPUnit_Framework_MockObject_MockObject|RuleInterface */ $rule = $this->getMock('AnimeDb\\SmartSleep\\Rule\\RuleInterface'); $this->assertEquals($this->collection, $this->collection->set('foo', $rule)); $this->assertTrue($this->collection->has('foo')); $this->assertEquals($rule, $this->collection->get('foo')); }