public function testOldAreChanged() { /* @var County $county */ $county = County::find('04'); $county->municipalities()->save(new Municipality(['id' => '0403', 'name' => 'Hamar'])); $county->municipalities()->save(new Municipality(['id' => '0417', 'name' => 'STANGE'])); $fired = false; $event = app(Dispatcher::class); $event->listen(ZipCodesUpdated::class, function (ZipCodesUpdated $update) use(&$fired) { $fired = true; $this->assertEquals(1, $update->changed); }); $cmd = new TestUpdateZipCodesCommand(); $cmd->fire($event); // $this->assertTrue($fired); }
public function testFindCountyArray() { County::create(['id' => 1, 'name' => 'Akershus']); County::create(['id' => 2, 'name' => 'Østfold']); $this->assertCount(2, County::find([1, 2])); }