/** * Initializes the token store. * * @param string|DocBlox_Token[]|string[] $data String to parse or a list of DocBlox_Tokens, or the result from a * token_get_all() method call. * @see token_get_all() * * @return void */ public function __construct($data) { // convert to token objects; converting up front is _faster_ than ad hoc conversion foreach ($data as $key => $token) { if ($token instanceof DocBlox_Token) { continue; } $data[$key] = new DocBlox_Token($token); } parent::__construct($data); }
/** * Tests whether the current method returns the element contained underneath the current pointer. * * Note: for some reason the current() keyword does not work; this has been observed with other ArrayObjects. * * @return void */ public function testCurrent() { $this->assertEquals(2, $this->fixture->seek(1)); // $this->assertEquals(2, current($this->fixture)); $this->assertEquals(2, $this->fixture->current()); }
/** * Tests whether unserialization provides the right results. * * @return void */ public function testUnserialize() { $f2 = new DocBlox_BidirectionalIterator(array()); $f2->unserialize(self::SERIALIZED); $this->assertEquals($this->fixture, $f2); }