protected function equalValues() { $book1 = new \book(); $book1->author = new \author('Terry Pratchett'); $book1->author->books[] = $book1; $book2 = new \book(); $book2->author = new \author('Terry Pratchett'); $book2->author->books[] = $book2; $object1 = new \sampleClass(4, 8, 15); $object2 = new \sampleClass(4, 8, 15); $storage1 = new \splObjectStorage(); $storage1->attach($object1); $storage2 = new \splObjectStorage(); $storage2->attach($object1); return array(array('a', 'A', 0, false, true), array(array('a' => 1, 'b' => 2), array('b' => 2, 'a' => 1)), array(array(1), array('1')), array(array(3, 2, 1), array(2, 3, 1), 0, true), array(2.3, 2.5, 0.5), array(1, 2, 1), array($object1, $object2), array($storage1, $storage2), array(new \dateTime('2013-03-29 04:13:35', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-29 04:13:35', new \dateTimeZone('America/New_York'))), array(new \dateTime('2013-03-29', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-29', new \dateTimeZone('America/New_York'))), array(new \dateTime('2013-03-29 04:13:35', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-29 03:13:35', new \dateTimeZone('America/Chicago'))), array(new \dateTime('2013-03-30', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-29 23:00:00', new \dateTimeZone('America/Chicago'))), array(new \dateTime('@1364616000'), new \dateTime('2013-03-29 23:00:00', new \dateTimeZone('America/Chicago'))), array(new \dateTime('2013-03-29T05:13:35-0500'), new \dateTime('2013-03-29T04:13:35-0600')), array(0, '0'), array('0', 0), array(2.3, '2.3'), array('2.3', 2.3), array((string) (1 / 3), 1 - 2 / 3), array(1 / 3, (string) (1 - 2 / 3)), array('string representation', new \classWithToString()), array(new \classWithToString(), 'string representation')); }
public function testAssertSplObjectStorageContainsObject() { $expected = new \stdClass(); $b = new \stdClass(); $actual = new \splObjectStorage(); $actual->attach($expected); $constraint = new testedClass($expected); $this->assertSame($constraint, $constraint->evaluate($actual)); $constraint = new testedClass($b); try { $constraint->evaluate($actual); $this->fail(); } catch (\PHPUnit_Framework_ExpectationFailedException $exception) { $analyzer = new atoum\tools\variable\analyzer(); $this->assertEquals($analyzer->getTypeOf($actual) . ' does not contain ' . $analyzer->getTypeOf($expected), $exception->getMessage()); } }
protected function notEqualValues() { $book1 = new \book(); $book1->author = new \author('Terry Pratchett'); $book1->author->books[] = $book1; $book2 = new \book(); $book2->author = new \author('Terry Pratch'); $book2->author->books[] = $book2; $book3 = new \book(); $book3->author = 'Terry Pratchett'; $book4 = new \stdClass(); $book4->author = 'Terry Pratchett'; $object1 = new \sampleClass(4, 8, 15); $object2 = new \sampleClass(16, 23, 42); $object3 = new \sampleClass(4, 8, 15); $storage1 = new \splObjectStorage(); $storage1->attach($object1); $storage2 = new \splObjectStorage(); $storage2->attach($object3); // same content, different object return array(array('a', 'b'), array('a', 'A'), array('9E6666666', '9E7777777'), array(1, 2), array(2, 1), array(2.3, 4.2), array(2.3, 4.2, 0.5), array(array(2.3), array(4.2), 0.5), array(array(array(2.3)), array(array(4.2)), 0.5), array(new \struct(2.3), new \struct(4.2), 0.5), array(array(new \struct(2.3)), array(new \struct(4.2)), 0.5), array(NAN, NAN), array(array(), array(0 => 1)), array(array(0 => 1), array()), array(array(0 => null), array()), array(array(0 => 1, 1 => 2), array(0 => 1, 1 => 3)), array(array('a', 'b' => array(1, 2)), array('a', 'b' => array(2, 1))), array(new \sampleClass(4, 8, 15), new \sampleClass(16, 23, 42)), array($object1, $object2), array($book1, $book2), array($book3, $book4), array(fopen(__FILE__, 'r'), fopen(__FILE__, 'r')), array($storage1, $storage2), array(new \dateTime('2013-03-29 04:13:35', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-29 03:13:35', new \dateTimeZone('America/New_York'))), array(new \dateTime('2013-03-29 04:13:35', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-29 03:13:35', new \dateTimeZone('America/New_York')), 3500), array(new \dateTime('2013-03-29 04:13:35', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-29 05:13:35', new \dateTimeZone('America/New_York')), 3500), array(new \dateTime('2013-03-29', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-30', new \dateTimeZone('America/New_York'))), array(new \dateTime('2013-03-29', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-30', new \dateTimeZone('America/New_York')), 43200), array(new \dateTime('2013-03-29 04:13:35', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-29 04:13:35', new \dateTimeZone('America/Chicago'))), array(new \dateTime('2013-03-29 04:13:35', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-29 04:13:35', new \dateTimeZone('America/Chicago')), 3500), array(new \dateTime('2013-03-30', new \dateTimeZone('America/New_York')), new \dateTime('2013-03-30', new \dateTimeZone('America/Chicago'))), array(new \dateTime('2013-03-29T05:13:35-0600'), new \dateTime('2013-03-29T04:13:35-0600')), array(new \dateTime('2013-03-29T05:13:35-0600'), new \dateTime('2013-03-29T05:13:35-0500')), array(new \sampleClass(4, 8, 15), false), array(false, new \sampleClass(4, 8, 15)), array(array(0 => 1, 1 => 2), false), array(false, array(0 => 1, 1 => 2)), array(array(), new \stdClass()), array(new \stdClass(), array()), array(0, 'Foobar'), array('Foobar', 0), array(3, acos(8)), array(acos(8), 3)); }
public function attach(cfhCompile_Class_Interface $class) { $this->list->attach($class); }
<?php $o1 = new stdClass(); $o2 = new stdClass(); $s = new splObjectStorage(); $s->attach($o1, array('prev' => 2, 'next' => $o2)); $s->attach($o2, array('prev' => $o1)); $ss = serialize($s); unset($s, $o1, $o2); echo $ss . "\n"; var_dump(unserialize($ss)); ?> ===DONE===
public function attachObserver(cfhCompile_Compiler_Observer_Interface $observer) { $this->observers->attach($observer); }