public function test_view_models_registered_by_same_way_are_not_identical_by_calling_them_by_using_returned_id() { $id1 = $this->repo->addFoo(1); $id2 = $this->repo->addFoo(2); $id3 = $this->repo->addFoo(3); $id4A = $this->repo->addFoo(4, 'A'); $id5B = $this->repo->addFoo(5, 'B'); $ids6A = $this->repo->addSuper(6, 'A'); $ids7B = $this->repo->addSuper(7, 'B'); $this->assertSame('Foo', $id1); $this->assertSame($id4A, 'FooA'); $this->assertSame($id5B, 'FooB'); $this->assertSame($ids6A, 'SuperA'); $this->assertSame($ids7B, 'SuperB'); $this->assertNotEquals('Foo', $id2); $this->assertNotEquals('Foo', $id3); $this->assertNotEquals('Foo', $id4A); $this->assertNotEquals('Foo', $id5B); $this->assertNotEquals($id1, $id2); $this->assertNotEquals($id1, $id3); $this->assertNotEquals($id1, $id4A); $this->assertNotEquals($id1, $id5B); $this->assertNotEquals($id2, $id3); $this->assertNotEquals($id2, $id4A); $this->assertNotEquals($id2, $id5B); $this->assertNotEquals($id3, $id4A); $this->assertNotEquals($id3, $id5B); $this->assertNotEquals($id4A, $id5B); $this->assertSame(1, $this->repo->getFoo($id1)->input[0]); $this->assertSame(1, $this->repo->getFoo()->input[0]); $this->assertSame(2, $this->repo->getFoo($id2)->input[0]); $this->assertSame(3, $this->repo->getFoo($id3)->input[0]); $this->assertSame(4, $this->repo->getFoo($id4A)->input[0]); $this->assertSame(4, $this->repo->getFoo('A')->input[0]); $this->assertSame(5, $this->repo->getFoo($id5B)->input[0]); $this->assertSame(5, $this->repo->getFoo('B')->input[0]); }
public function test_Should_Create_Multiple_View_Models_By_Same_Typ_And_Different_Content() { $data_1 = array('data1' => 'ABC', 'data2' => 'BCD', 'data3' => 'CDE', 'data4' => 'DEF', 'data5' => 'EFG'); $data_2 = array('data1' => 'aA', 'data2' => 'Bb', 'data3' => 'cC', 'data4' => 'Dd', 'data5' => 'eE'); $data_3 = array('data1' => 'Maria', 'data2' => 'Petra', 'data3' => 'Conny', 'data4' => 'Lisett', 'data5' => 'Rimma'); $this->repo->addSuper($data_1); $this->repo->addSuper($data_2, 'special_model'); $this->repo->addSuper($data_3, 'id_B'); $view_1 = $this->repo->getSuper(); $view_2 = $this->repo->getSuper('special_model'); $view_3 = $this->repo->getSuper('id_B'); $this->assertSame($data_1, get_object_vars($view_1)); $this->assertSame($data_2, get_object_vars($view_2)); $this->assertSame($data_3, get_object_vars($view_3)); }